--- title: Generics description: Generic functions, structs, enums, trait bounds, and lifetimes. icon: Braces --- ```mist // Generic function T id(T x) { x } // Generic struct struct Pair { A first, B second, } // Generic enum enum Result { Ok(T), Err(E), } // Generic with trait bounds T max(T a, T b) { if a > b { a } else { b } } // Lifetime generics void process<'a>(&'a str& data) { // ... } ``` Generic syntax uses `<` `>` delimiters. Lifetimes are prefixed with `'`.