pub(crate) struct Slab<T> {
next_vacant: usize,
entries: Vec<Entry<T>>,
}
Fields§
§next_vacant: usize
§entries: Vec<Entry<T>>
Implementations§
source§impl<T> Slab<T>
impl<T> Slab<T>
pub fn new() -> Self
sourcepub fn insert(&mut self, value: T) -> usize
pub fn insert(&mut self, value: T) -> usize
Inserts value into this linked vec and returns index at which value can be accessed in constant time.
pub fn len(&self) -> usize
pub unsafe fn get_unchecked(&self, index: usize) -> &T
pub unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T
pub fn get(&self, index: usize) -> &T
pub fn get_mut(&mut self, index: usize) -> &mut T
pub unsafe fn remove_unchecked(&mut self, index: usize) -> T
pub fn remove(&mut self, index: usize) -> T
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Slab<T>
impl<T> RefUnwindSafe for Slab<T>where
T: RefUnwindSafe,
impl<T> Send for Slab<T>where
T: Send,
impl<T> Sync for Slab<T>where
T: Sync,
impl<T> Unpin for Slab<T>where
T: Unpin,
impl<T> UnwindSafe for Slab<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more