10. Generici

Template type-safe per struct e funzioni.

// Struct Generico
struct Scatola<T> {
    oggetto: T;
}

// Funzione Generica
fn identità<T>(valore: T) -> T {
    return valore;
}

// Generici Multi-parametro
struct Paio<K, V> {
    chiavi: K;
    valore: V;
}