4 ms·
> Since a NonNull<T> can never be null, the compiler knows it can use the 0 address to represent the None variant when it sees an Option<NonNull<T>> I didn't k
by sedatk 1y ago
> Since a NonNull<T> can never be null, the compiler knows it can use the 0 address to represent the None variant when it sees an Option<NonNull<T>>
I didn't know this about Rust. That's awesome.
- danhau 1y agoSame optimizations apply to the various NonZero types, IIRC.