[][src]Trait nitric_component::allocator::Allocator

pub trait Allocator<ID> where
    ID: Id<Allocator = Self>, 
{ fn is_valid(&self, id: &ID) -> bool;
fn num_valid(&self) -> usize;
fn num_valid_hint(&self) -> (usize, Option<usize>); }

Generic allocator for IDs of type ID.

Required Methods

Checks if id is a valid ID.

This can return false for example if the ID has been deleted.

Panics

Panics in debug mode if id was allocated by a different allocator.

Retrieves the number of valid IDs. This may or may not be expensive to calculate.

If you're looking for this for optimization purposes, use num_valid_hint instead.

Returns a hint for the number of valid IDs. This should be preferred over num_valid when used for optimization purposes.

The first element of the tuple is the minimal number of valid IDs, the latter the maximum.

If the first and the second are equal, this hint must be accurate. If the latter is None, the operation is non-trivial and num_valid must be used to retrieve the accurate number.

Implementors

impl Allocator<FlatUsize> for FlatAllocator
[src]

impl<ID> Allocator<ID> for PhantomAllocator where
    ID: Id<Allocator = Self>, 
[src]