[][src]Struct ruyi_slab::Entry

pub struct Entry<'a, T> { /* fields omitted */ }

A handle to a free slot in a Slab<T>.

Implementations

impl<'a, T> Entry<'a, T>[src]

pub fn index(&self) -> usize[src]

Returns the index of the free slot that this entry refers to.

Examples

let mut slab = Slab::with_capacity(2);
slab.insert(1);
let entry = slab.free_entry();
let index = entry.index();
entry.insert(index);

assert_eq!(slab.len(), 2);
assert_eq!(slab[index], index);

pub fn insert(self, obj: T)[src]

Inserts the specified object into the slot this entry refers to.

Examples

let mut slab = Slab::with_capacity(2);
slab.insert(1);
let entry = slab.free_entry();
let index = entry.index();
entry.insert(index);

assert_eq!(slab.len(), 2);
assert_eq!(slab[index], index);

Trait Implementations

impl<'a, T: Debug> Debug for Entry<'a, T>[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Entry<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Send for Entry<'a, T> where
    T: Send

impl<'a, T> Sync for Entry<'a, T> where
    T: Sync

impl<'a, T> Unpin for Entry<'a, T>

impl<'a, T> !UnwindSafe for Entry<'a, 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.