Hacker News new | ask | show | jobs
by sedatk 247 days 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.

1 comments

Same optimizations apply to the various NonZero types, IIRC.