@@ -1119,6 +1119,12 @@ impl<'a, T: ?Sized + Unpin> PinMut<'a, T> {
1119
1119
pub fn new ( reference : & ' a mut T ) -> PinMut < ' a , T > {
1120
1120
PinMut { inner : reference }
1121
1121
}
1122
+
1123
+ /// Get a mutable reference to the data inside of this `PinMut`.
1124
+ #[ unstable( feature = "pin" , issue = "49150" ) ]
1125
+ pub fn get_mut ( this : PinMut < ' a , T > ) -> & ' a mut T {
1126
+ this. inner
1127
+ }
1122
1128
}
1123
1129
1124
1130
@@ -1150,21 +1156,21 @@ impl<'a, T: ?Sized> PinMut<'a, T> {
1150
1156
/// the data out of the mutable reference you receive when you call this
1151
1157
/// function.
1152
1158
#[ unstable( feature = "pin" , issue = "49150" ) ]
1153
- pub unsafe fn get_mut ( this : PinMut < ' a , T > ) -> & ' a mut T {
1159
+ pub unsafe fn get_mut_unchecked ( this : PinMut < ' a , T > ) -> & ' a mut T {
1154
1160
this. inner
1155
1161
}
1156
1162
1157
1163
/// Construct a new pin by mapping the interior value.
1158
1164
///
1159
- /// For example, if you wanted to get a `PinMut` of a field of something, you
1160
- /// could use this to get access to that field in one line of code.
1165
+ /// For example, if you wanted to get a `PinMut` of a field of something,
1166
+ /// you could use this to get access to that field in one line of code.
1161
1167
///
1162
1168
/// This function is unsafe. You must guarantee that the data you return
1163
1169
/// will not move so long as the argument value does not move (for example,
1164
1170
/// because it is one of the fields of that value), and also that you do
1165
1171
/// not move out of the argument you receive to the interior function.
1166
1172
#[ unstable( feature = "pin" , issue = "49150" ) ]
1167
- pub unsafe fn map < U , F > ( this : PinMut < ' a , T > , f : F ) -> PinMut < ' a , U > where
1173
+ pub unsafe fn map_unchecked < U , F > ( this : PinMut < ' a , T > , f : F ) -> PinMut < ' a , U > where
1168
1174
F : FnOnce ( & mut T ) -> & mut U
1169
1175
{
1170
1176
PinMut { inner : f ( this. inner ) }
0 commit comments