use std::fmt; #[derive(Clone, Debug)] pub struct UserRef { pub username: String, pub domain: String, } impl fmt::Display for UserRef { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}@{}", self.username, self.domain) } } #[derive(Clone, Debug)] pub struct User { pub username: String, pub domain: String, pub password: String, pub mail: String, // recovery_mail: String, } impl User { pub fn user_ref(&self) -> UserRef { UserRef { username: self.username.clone(), domain: self.domain.clone(), } } } impl fmt::Display for User { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}@{}", self.username, self.domain) } }