Generics
Generic function with type constrained to implement Debug
and PartialOrder
traits:
#![allow(unused)] fn main() { fn return_me<T: Debug + PartialOrder>(arg: T) -> T { println!("{:?}", arg); arg } }
or
#![allow(unused)] fn main() { fn return_me<T>(arg: T) -> T where T: Debug + PartialOrder { println!("{:?}", arg); arg } }