Guest User

Untitled

a guest
Jul 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #[derive(Debug)]
  2. struct User {
  3. username: String,
  4. email: String,
  5. sign_in_count: u64,
  6. active: bool,
  7. }
  8.  
  9. impl User {
  10. fn new(username: String) -> User {
  11. User {
  12. username: username.clone(),
  13. email: format!("{}@user.com", username),
  14. sign_in_count: 1,
  15. active: true,
  16. }
  17. }
  18. }
  19.  
  20. fn main() {
  21. let u1 = User::new("Chuck Norris".to_string());
  22. println!("Hello {:?}", u1)
  23. }
Add Comment
Please, Sign In to add comment