greyblake / nutype

Rust newtype with guarantees πŸ‡ΊπŸ‡¦ πŸ¦€
MIT License
1.4k stars 23 forks source link

Allow trait boundaries for generic newtypes #142

Closed greyblake closed 3 months ago

greyblake commented 4 months ago

The following type must be possible to declare:

#[nutype(
    sanitize(with = |v| { v.sort(); v }),
    derive(Debug)
)]
struct SortedVec<T: Ord>(Vec<T>)