Struct rafx_base::slab::RawSlab [−][src]
pub struct RawSlab<T> { /* fields omitted */ }
A very simple, minimalist slab structure. Consider using one of the other slabs instead as they are less error prone for many use-cases.
Implementations
impl<T> RawSlab<T>
[src]
pub fn new() -> Self
[src]
Create an empty RawSlab
pub fn with_capacity(capacity: SlabIndexT) -> Self
[src]
Create an empty but presized RawSlab
pub fn allocate(&mut self, value: T) -> RawSlabKey<T>
[src]
Allocate a slot within the raw slab.
Allocation can cause vectors to be resized. Use with_capacity
to avoid this.
pub fn allocate_with_key<F: FnMut(RawSlabKey<T>) -> T>(
&mut self,
f: F
) -> RawSlabKey<T>
[src]
&mut self,
f: F
) -> RawSlabKey<T>
pub fn free(&mut self, slab_key: RawSlabKey<T>)
[src]
Free an element in the raw slab. It is fatal to free an element that doesn’t exist.
pub fn exists(&self, slab_key: RawSlabKey<T>) -> bool
[src]
Check if an element exists
pub fn get(&self, slab_key: RawSlabKey<T>) -> Option<&T>
[src]
Try to get the given element
pub fn get_mut(&mut self, slab_key: RawSlabKey<T>) -> Option<&mut T>
[src]
Try to get the given element
pub fn iter(&self) -> impl Iterator<Item = (RawSlabKey<T>, &T)>
[src]
Iterate all values
pub fn iter_mut(&mut self) -> impl Iterator<Item = (RawSlabKey<T>, &mut T)>
[src]
Iterate all values
pub fn allocated_count(&self) -> usize
[src]
Return count of allocated Ts
pub fn storage_size(&self) -> usize
[src]
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for RawSlab<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for RawSlab<T> where
T: Send,
T: Send,
impl<T> Sync for RawSlab<T> where
T: Sync,
T: Sync,
impl<T> Unpin for RawSlab<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for RawSlab<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Resource for T where
T: Downcast + Send + Sync,
[src]
T: Downcast + Send + Sync,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,