generics
Code written once for many types, with the type left as a parameter.
Generics let a function, struct, enum, trait, or impl take type parameters (like T), filled in with concrete types where it is used.
Examples
fn count_above<T: PartialOrd>(items: &[T], limit: &T) -> usizeworks for a slice off64temperatures,i32scores or anything else comparable.
See also