Traits in rust
trait Greet { fn say_hello(&self); } impl Greet for String { fn say_hello(&self) { println!("Hello how are you? {}", self); } } impl Greet for i32 { fn say_hello(&self) { println!("Hello i32 {}", self); } } fn greet_static<T: Greet>(item: T) { item.say_hello(); } fn main() { greet_static("nigga".to_string()); }