Struct entity::IdAllocator[][src]

pub struct IdAllocator { /* fields omitted */ }

Represents the allocator of unique ids

Implementations

impl IdAllocator[src]

pub fn new() -> Self[src]

Creates a new allocator using the default parameters

pub fn set_next_id(&mut self, id: Id)[src]

Updates the next id in the allocator to the id provided.

pub fn mark_external_id(&mut self, id: Id)[src]

Adjusts the next id of the allocator to beyond the given id if possible. This is useful when ids are allocated outside of the allocator and we want to make sure that the allocator does not duplicate those ids.

pub fn has_next(&self) -> bool[src]

Indicates whether or not the allocator has more ids available, either from the freed pool or by incrementing its counter

pub fn freed(&self) -> &[Id][src]

Represents the ids that have been freed and will be returned by the allocator before generating new ids

Trait Implementations

impl Debug for IdAllocator[src]

impl Default for IdAllocator[src]

fn default() -> Self[src]

Creates a new allocator starting with no freed ids and beginning with the next id after the ephemeral id

impl Eq for IdAllocator[src]

impl Extend<usize> for IdAllocator[src]

fn extend<I: IntoIterator<Item = Id>>(&mut self, iter: I)[src]

Extends the collection of freed ids with the given iterator of ids

impl Iterator for IdAllocator[src]

type Item = Id

The type of the elements being iterated over.

fn next(&mut self) -> Option<Self::Item>[src]

Produces a range by either yielding one of the freed pool ranges or allocating a new range of ids

This should always yield a new range and should be assumed to be infinite. If the allocator has run out of ids, it will return None, and this would indicate a problem that should panic.

impl PartialEq<IdAllocator> for IdAllocator[src]

impl StructuralEq for IdAllocator[src]

impl StructuralPartialEq for IdAllocator[src]

Auto Trait Implementations

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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.