Would there be any appetite to add an
Result types specialised for pointers? It's very common for C functions to use null to mean "no value" in function parameters or "error" in returned values.
If I understand
std::ptr::NonNull documentation correctly this can be done without needing anything new in the standard library. E.g. something like this:
use core::ptr; type PtrOption<T> = Option<ptr::NonNull<T>>; type PtrResult<T> = Result<ptr::NonNull<T>, ()>;
However, I think there's merit in having a consistently named type that's conveniently available in core. Especially given that the NonNull documentation doesn't seem to encourage its use.