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