Coggle requires JavaScript to display documents.
pub trait Summary { fn summarize(&self) -> String { String::from("(Read more...)"); } } impl Summart for NewsArticle {}
pub trait Summary { fn summarize_author(&self) -> String; fn summarize(&self) -> String { println!("read more from {}", self.summarize_author()) } }
pub fn notify<T: Summary>(item: T) { println!("{}", item.summarize()); }
pub fn some_function<T: Clone + Summary, U: Display + Clone>(t: T, u: U) -> i32 {}
where
pub fn some_function<T, U>(t: T, u: U) -> i32 where T: Clone + Summary, U: Clone + Display {}
pub trait Summary { fn summarize(&self) -> String; }
pub struct NewsArticle { pub headline: String, pub location: String, pub author: String, pub content: String, } impl Summary for NewsArticle { fn summarize(&self) -> String { println!("{}, by {} ({})", self.headline, self.author, self.location); } }
struct Pair<T> { x: T, y: T, } impl<T> Pair<T> { fn new(x: T, y: T) -> self { self { x, y, } } } impl<T: PartialOrd + Display> Pair<T> { fn cmd_display(&self) { println!("some string"); } }
impl<T: Display> ToString for T {}