File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 74
74
#![ deny( missing_debug_implementations) ]
75
75
76
76
#![ feature( allow_internal_unstable) ]
77
+ #![ feature( arbitrary_self_types) ]
77
78
#![ feature( asm) ]
78
79
#![ feature( associated_type_defaults) ]
79
80
#![ feature( attr_literals) ]
Original file line number Diff line number Diff line change 147
147
148
148
use iter:: { FromIterator , FusedIterator , TrustedLen } ;
149
149
use { mem, ops} ;
150
+ use mem:: PinMut ;
150
151
151
152
// Note that this is not a lang item per se, but it has a hidden dependency on
152
153
// `Iterator`, which is one. The compiler assumes that the `next` method of
@@ -269,6 +270,15 @@ impl<T> Option<T> {
269
270
}
270
271
}
271
272
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
+
272
282
/////////////////////////////////////////////////////////////////////////
273
283
// Getting to contained values
274
284
/////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments