Struct veloren_common::depot::Depot
source · pub struct Depot<T> {
entries: Vec<Entry<T>>,
len: usize,
}
Expand description
A general-purpose high performance allocator, basically Vec with type safe indices (Id)
Fields§
§entries: Vec<Entry<T>>
§len: usize
Implementations§
source§impl<T> Depot<T>
impl<T> Depot<T>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn contains(&self, id: Id<T>) -> bool
pub fn get(&self, id: Id<T>) -> Option<&T>
pub fn get_mut(&mut self, id: Id<T>) -> Option<&mut T>
pub fn ids(&self) -> impl Iterator<Item = Id<T>> + '_
pub fn values(&self) -> impl Iterator<Item = &T> + '_
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut T> + '_
pub fn iter(&self) -> impl Iterator<Item = (Id<T>, &T)> + '_
pub fn iter_mut(&mut self) -> impl Iterator<Item = (Id<T>, &mut T)> + '_
pub fn insert(&mut self, item: T) -> Id<T>
pub fn remove(&mut self, id: Id<T>) -> Option<T>
pub fn recreate_id(&self, i: u64) -> Option<Id<T>>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Depot<T>
impl<T> RefUnwindSafe for Depot<T>where
T: RefUnwindSafe,
impl<T> Send for Depot<T>where
T: Send,
impl<T> Sync for Depot<T>where
T: Sync,
impl<T> Unpin for Depot<T>where
T: Unpin,
impl<T> UnwindSafe for Depot<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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<Context> SubContext<Context> for Context
impl<Context> SubContext<Context> for Context
fn sub_context(self) -> Context
§impl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Tries to create the default.
§fn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls
try_default
and panics on an error case.