Struct pin_api::PinMut
[−]
[src]
pub struct PinMut<'a, T: ?Sized + 'a> { /* fields omitted */ }
A pinned mutable reference.
The value referenced by this is guaranteed never to move again, unless it
implements Unpin
.
Methods
impl<'a, T: Unpin + ?Sized> PinMut<'a, T>
[src]
pub fn new(ptr: &'a mut T) -> PinMut<'a, T>
[src]
Create a new PinMut from a mutable reference to a moveable type.
impl<'a, T: ?Sized> PinMut<'a, T>
[src]
pub unsafe fn new_unchecked(ptr: &'a mut T) -> PinMut<'a, T>
[src]
Construct a new PinMut
without checking that the data is actually
pinned.
You must guarantee that the data meets the requirements for
constructing a PinMut
.
An example use case is constructing a PinMut
of a field of this type:
let inner = unsafe { PinMut::new_unchecked(&mut this.inner) };
pub fn borrow<'b>(this: &'b mut PinMut<'a, T>) -> PinMut<'b, T>
[src]
Get a PinMut with a shorter lifetime
pub unsafe fn get<'b>(this: &'b mut PinMut<'a, T>) -> &'b T
[src]
Get a reference to the data inside this type.
This is unsafe, because you must guarantee that you do not move the data out of the reference that this function returns.
pub unsafe fn get_mut<'b>(this: &'b mut PinMut<'a, T>) -> &'b mut T
[src]
Get a mutable reference to the data inside this type.
This is unsafe, because you must guarantee that you do not move the data out of the mutable reference that this function returns.
Trait Implementations
impl<'a, T: ?Sized> Deref for PinMut<'a, T>
[src]
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
Dereferences the value.
impl<'a, T: Unpin + ?Sized> DerefMut for PinMut<'a, T>
[src]
impl<'a, T: ?Sized, U> CoerceUnsized<PinMut<'a, U>> for PinMut<'a, T> where
T: Unsize<U>,
U: ?Sized,
[src]
T: Unsize<U>,
U: ?Sized,