Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- struct User {
- username: String,
- email: String,
- sign_in_count: u64,
- active: bool,
- }
- impl User {
- fn new(username: String) -> User {
- User {
- username: username.clone(),
- email: format!("{}@user.com", username),
- sign_in_count: 1,
- active: true,
- }
- }
- }
- fn main() {
- let u1 = User::new("Chuck Norris".to_string());
- println!("Hello {:?}", u1)
- }
Add Comment
Please, Sign In to add comment