Feature Request: Convert option-types to pointers


#1

The pointer primitive has

unsafe fn as_ref<'a>(self) -> Option<&'a T>;

but the converse doesn’t seem to exist

fn from_ref(Option<&T>) -> *const T;

but I think it should. :slight_smile: Not sure what module it’d go in, though - std::ptr?

Is this even where feature requests go?


#2

There’s some previous discussion in this rfc issue


#3

At least for now I suggest you write an extension trait for Option and put your method in there. That way you don’t need to care about stdlib, and you still get nice method syntax.