[−][src]Struct alloc::pin::PinMut
A pinned reference.
This type is similar to a mutable reference, except that it pins its value,
which prevents it from moving out of the reference, unless it implements Unpin
.
See the pin
module documentation for furthur explanation on pinning.
Methods
impl<'a, T> PinMut<'a, T> where
T: Unpin + ?Sized,
[src]
impl<'a, T> PinMut<'a, T> where
T: Unpin + ?Sized,
pub fn new(reference: &'a mut T) -> PinMut<'a, T>
[src]
pub fn new(reference: &'a mut T) -> PinMut<'a, T>
Construct a new PinMut
around a reference to some data of a type that
implements Unpin
.
pub fn get_mut(this: PinMut<'a, T>) -> &'a mut T
[src]
pub fn get_mut(this: PinMut<'a, T>) -> &'a mut T
Get a mutable reference to the data inside of this PinMut
.
impl<'a, T> PinMut<'a, T> where
T: ?Sized,
[src]
impl<'a, T> PinMut<'a, T> where
T: ?Sized,
pub unsafe fn new_unchecked(reference: &'a mut T) -> PinMut<'a, T>
[src]
pub unsafe fn new_unchecked(reference: &'a mut T) -> PinMut<'a, T>
Construct a new PinMut
around a reference to some data of a type that
may or may not implement Unpin
.
This constructor is unsafe because we do not know what will happen with that data after the lifetime of the reference ends. If you cannot guarantee that the data will never move again, calling this constructor is invalid.
pub fn reborrow(&'b mut self) -> PinMut<'b, T>
[src]
pub fn reborrow(&'b mut self) -> PinMut<'b, T>
Reborrow a PinMut
for a shorter lifetime.
For example, PinMut::get_mut(x.reborrow())
(unsafely) returns a
short-lived mutable reference reborrowing from x
.
pub unsafe fn get_mut_unchecked(this: PinMut<'a, T>) -> &'a mut T
[src]
pub unsafe fn get_mut_unchecked(this: PinMut<'a, T>) -> &'a mut T
Get a mutable reference to the data inside of this PinMut
.
This function is unsafe. You must guarantee that you will never move the data out of the mutable reference you receive when you call this function.
pub unsafe fn map_unchecked<U, F>(this: PinMut<'a, T>, f: F) -> PinMut<'a, U> where
F: FnOnce(&mut T) -> &mut U,
[src]
pub unsafe fn map_unchecked<U, F>(this: PinMut<'a, T>, f: F) -> PinMut<'a, U> where
F: FnOnce(&mut T) -> &mut U,
Construct a new pin by mapping the interior value.
For example, if you wanted to get a PinMut
of a field of something,
you could use this to get access to that field in one line of code.
This function is unsafe. You must guarantee that the data you return will not move so long as the argument value does not move (for example, because it is one of the fields of that value), and also that you do not move out of the argument you receive to the interior function.
pub fn set(this: PinMut<'a, T>, value: T)
[src]
pub fn set(this: PinMut<'a, T>, value: T)
Assign a new value to the memory behind the pinned reference.
Trait Implementations
impl<'a, T, F> UnsafeFutureObj<'a, T> for PinMut<'a, F> where
F: Future<Output = T> + 'a,
[src]
impl<'a, T, F> UnsafeFutureObj<'a, T> for PinMut<'a, F> where
F: Future<Output = T> + 'a,
fn into_raw(self) -> *mut ()
[src]
fn into_raw(self) -> *mut ()
🔬 This is a nightly-only experimental API. (futures_api
#50547)
futures in libcore are unstable
Convert an owned instance into a (conceptually owned) void pointer.
unsafe fn poll(ptr: *mut (), cx: &mut Context) -> Poll<T>
[src]
unsafe fn poll(ptr: *mut (), cx: &mut Context) -> Poll<T>
🔬 This is a nightly-only experimental API. (futures_api
#50547)
futures in libcore are unstable
Poll the future represented by the given void pointer. Read more
unsafe fn drop(_ptr: *mut ())
[src]
unsafe fn drop(_ptr: *mut ())
🔬 This is a nightly-only experimental API. (futures_api
#50547)
futures in libcore are unstable
Drops the future represented by the given void pointer. Read more
impl<'a, T> Pointer for PinMut<'a, T> where
T: ?Sized,
[src]
impl<'a, T> Pointer for PinMut<'a, T> where
T: ?Sized,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl<'a, T> Debug for PinMut<'a, T> where
T: Debug + ?Sized,
[src]
impl<'a, T> Debug for PinMut<'a, T> where
T: Debug + ?Sized,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<'a, T, U> CoerceUnsized<PinMut<'a, U>> for PinMut<'a, T> where
T: Unsize<U> + ?Sized,
U: ?Sized,
[src]
impl<'a, T, U> CoerceUnsized<PinMut<'a, U>> for PinMut<'a, T> where
T: Unsize<U> + ?Sized,
U: ?Sized,
impl<'a, T> Unpin for PinMut<'a, T> where
T: ?Sized,
[src]
impl<'a, T> Unpin for PinMut<'a, T> where
T: ?Sized,
impl<'a, F> Future for PinMut<'a, F> where
F: Future + ?Sized,
[src]
impl<'a, F> Future for PinMut<'a, F> where
F: Future + ?Sized,
type Output = <F as Future>::Output
🔬 This is a nightly-only experimental API. (futures_api
#50547)
futures in libcore are unstable
The result of the Future
.
fn poll(
self: PinMut<PinMut<'a, F>>,
cx: &mut Context
) -> Poll<<PinMut<'a, F> as Future>::Output>
[src]
fn poll(
self: PinMut<PinMut<'a, F>>,
cx: &mut Context
) -> Poll<<PinMut<'a, F> as Future>::Output>
🔬 This is a nightly-only experimental API. (futures_api
#50547)
futures in libcore are unstable
Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
impl<'a, T> DerefMut for PinMut<'a, T> where
T: Unpin + ?Sized,
[src]
impl<'a, T> DerefMut for PinMut<'a, T> where
T: Unpin + ?Sized,
impl<'a, T> Deref for PinMut<'a, T> where
T: ?Sized,
[src]
impl<'a, T> Deref for PinMut<'a, T> where
T: ?Sized,
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
fn deref(&self) -> &T
Dereferences the value.
impl<'a, T> Display for PinMut<'a, T> where
T: Display + ?Sized,
[src]
impl<'a, T> Display for PinMut<'a, T> where
T: Display + ?Sized,
Auto Trait Implementations
impl<'a, T: ?Sized> Send for PinMut<'a, T> where
T: Send,
impl<'a, T: ?Sized> Send for PinMut<'a, T> where
T: Send,
impl<'a, T: ?Sized> Sync for PinMut<'a, T> where
T: Sync,
impl<'a, T: ?Sized> Sync for PinMut<'a, T> where
T: Sync,
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
#27745)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more