File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 7474#![ deny( missing_debug_implementations) ]
7575
7676#![ feature( allow_internal_unstable) ]
77+ #![ feature( arbitrary_self_types) ]
7778#![ feature( asm) ]
7879#![ feature( associated_type_defaults) ]
7980#![ feature( attr_literals) ]
Original file line number Diff line number Diff line change 147147
148148use iter:: { FromIterator , FusedIterator , TrustedLen } ;
149149use { mem, ops} ;
150+ use mem:: PinMut ;
150151
151152// Note that this is not a lang item per se, but it has a hidden dependency on
152153// `Iterator`, which is one. The compiler assumes that the `next` method of
@@ -269,6 +270,15 @@ impl<T> Option<T> {
269270 }
270271 }
271272
273+ /// Converts from `Option<T>` to `Option<PinMut<'_, T>>`
274+ #[ inline]
275+ #[ unstable( feature = "pin" , issue = "49150" ) ]
276+ pub fn as_pin_mut < ' a > ( self : PinMut < ' a , Self > ) -> Option < PinMut < ' a , T > > {
277+ unsafe {
278+ PinMut :: get_mut ( self ) . as_mut ( ) . map ( |x| PinMut :: new_unchecked ( x) )
279+ }
280+ }
281+
272282 /////////////////////////////////////////////////////////////////////////
273283 // Getting to contained values
274284 /////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments