Last active
January 16, 2022 08:03
-
-
Save FermiDirak/9cf2c87ed6b43f559a43da54d708fd0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// user_model.rs | |
struct UserModel { /* ... */ } | |
impl UserModel { | |
pub fn fullname() -> String; | |
// ... | |
} | |
// happy_birthday_service.rs | |
pub fn send_message(session_context: &SessionContext, /* ... */) { | |
let message = session_context.user.happy_birthday_message(); | |
send_email(sesson_context.user.email, message); | |
} | |
impl UserModel { | |
pub fn happy_birthday_message(&self) -> String { | |
format!("Happy birthday, {} 🎉", self.fullname()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment