In porting some code from *mut T to NonNull<T>, I've been having to add a lot of .as_ptr() conversions in order to dereference (i.e., *ptr vs *ptr.as_ptr()). It'd be great it were possible to dereference NonNull directly when in unsafe blocks.
My guess is that this would require adding some sort of UnsafeDeref/UnsafeDerefMut traits and making the compiler know about them, so this is probably no simple task.
In porting some code from
*mut TtoNonNull<T>, I've been having to add a lot of.as_ptr()conversions in order to dereference (i.e.,*ptrvs*ptr.as_ptr()). It'd be great it were possible to dereferenceNonNulldirectly when in unsafe blocks.My guess is that this would require adding some sort of
UnsafeDeref/UnsafeDerefMuttraits and making the compiler know about them, so this is probably no simple task.