Struct exit_stack::Slot[][src]

pub struct Slot<'lt, T> { /* fields omitted */ }

A stack allocation that one can pin a value into.

This contains two references: One to uninitialized stack allocated memory large enough to store a value of the requested type into, and another reference to the head of a linked list of pinned values. When the caller decides to fill the slot then it is written to the stack memory and prepended to the linked list such that the value is guaranteed to drop before all other values contained in it.

Implementations

impl<'lt, T> Slot<'lt, T>[src]

pub fn pin(self, value: T) -> Pin<&'lt mut T> where
    T: 'static, 
[src]

Pin a value to the stack.

Returns the value if there is no more space in the reserved portion of memory to pin the new value. You might try calling pop_all then to free some.

Note that dropping might be delayed arbitrarily as the ExitStack has no control over its own drop point, hence values must live for a static duration.

pub unsafe fn pin_local(self, value: T) -> Pin<&'lt mut T>[src]

Pin a short-lived value to this exit stack.

Safety

The caller guarantees that the exit stack is dropped before the validity of T expires.

Auto Trait Implementations

impl<'lt, T> !Send for Slot<'lt, T>

impl<'lt, T> !Sync for Slot<'lt, T>

impl<'lt, T> Unpin for Slot<'lt, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.