new( username: &String, email: &String, sign_in_count: u64, active: bool ) -> Self { User { username: username.to_owned(), email: email.to_owned(), sign_in_count: sign_in_count, active: active, } } } constructor call // ... let user = User::new( &String::from("User"), &String::from("
[email protected]"), 5, true, ); string copy - It’s quite common practice to write constructors for structs - Constructor can have any name that developer would like to use - Usage the new(…) method is the rule of thumb