2 ms·
Anything of type `&T` has the same sizing property as `num::NonZeroU64`: the size of `Option<&T>` is the same as the size of `&T`. So I think you would just use
by returningfory2 5y ago
Anything of type `&T` has the same sizing property as `num::NonZeroU64`: the size of `Option<&T>` is the same as the size of `&T`. So I think you would just use a plan old Option?
- ridiculous_fish 5y agoThe problem with &T is that you can't make one to just-past-the-end of an array. If you look at the implementation of slice::Iter, it stores a (cursor, end) pointer pair, but there's no way to say "this is a non-null const pointer" so it casts the cursor pointer to *mut. https://doc.rust-lang.org/src/core/slice/iter.rs.html#67 https://doc.rust-lang.org/src/core/slice/iter.rs.html#67