blob: 643906f691377b994f94e8993b634760d8428fae [file] [log] [blame]
// ANCHOR: here
pub trait Summary {
fn summarize_author(&self) -> String;
fn summarize(&self) -> String {
format!("(Read more from {}...)", self.summarize_author())
}
}
// ANCHOR_END: here
pub struct Tweet {
pub username: String,
pub content: String,
pub reply: bool,
pub retweet: bool,
}
// ANCHOR: impl
impl Summary for Tweet {
fn summarize_author(&self) -> String {
format!("@{}", self.username)
}
}
// ANCHOR_END: impl