Rust theorytheory 0/50 · 0%
Abstraction · medium

21. Generics

Write once, monomorphise for each type.

Generic parameters abstract over types with zero runtime cost: the compiler emits a specialised copy per concrete type. Bounds such as `T: Ord` state what capabilities the code requires, and where-clauses keep complex signatures readable.

Check your understanding

  1. 1. Generics in Rust are…

  2. 2. What does `T: Ord` express?