Rename PinMut::borrow to PinMut::reborrow and make it a method

This commit is contained in:
Ralf Jung 2018-05-07 13:56:24 +02:00
parent 17206a7e64
commit 8619e19dc4

View File

@ -1129,10 +1129,13 @@ impl<'a, T: ?Sized> PinMut<'a, T> {
PinMut { inner: reference }
}
/// Borrow a PinMut for a shorter lifetime than it already has.
/// Reborrow a `PinMut` for a shorter lifetime.
///
/// For example, `PinMut::get_mut(x.reborrow())` (unsafely) returns a
/// short-lived mutable reference reborrowing from `x`.
#[unstable(feature = "pin", issue = "49150")]
pub fn borrow<'b>(this: &'b mut PinMut<'a, T>) -> PinMut<'b, T> {
PinMut { inner: this.inner }
pub fn reborrow<'b>(&'b mut self) -> PinMut<'b, T> {
PinMut { inner: self.inner }
}
/// Get a mutable reference to the data inside of this `PinMut`.