-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rs
27 lines (23 loc) · 789 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use aggregator::{NewsArticle, Summary, Tweet};
mod aggregator;
fn notify(item: &impl Summary) {
println!("[Breaking News]: {}", item.summarize());
}
fn main() {
let tweet = Tweet {
username: String::from("tcm"),
content: String::from("era of abundance... is it really?"),
retweet: false,
reply: false,
};
println!("Tweet Summary: {}", tweet.summarize());
notify(&tweet);
let news = NewsArticle {
author: String::from("the common man"),
location: String::from("news paper"),
content: String::from("era of abundance... is it really?"),
headline: String::from("era of abundance... is it really?"),
};
println!("NewsArticle Summary (default impl): {}", news.summarize());
notify(&news);
}