use std::fmt::Display; fn main() { let string1 = String::from("RUST"); let string2 = "C"; let result = longest(string1.as_str(), string2); println!("The longest string is {}", result); println!( "longest string: {}", longest_with_an_announcement("hello", "kitty", &"tiger") ) } fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { if x.len() > y.len() { x } else { y } } fn longest_with_an_announcement<'a, T>(x: &'a str, y: &'a str, ann: &'a T) -> &'a str where T: Display, { println!("Announcement! {}", ann); if x.len() > y.len() { x } else { y } }