Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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.



Same optimizations apply to the various NonZero types, IIRC.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: