[][src]Struct slot_generator::SlotGenerator

pub struct SlotGenerator<T> where
    T: PrimInt,
    Range<T>: ExactSizeIterator
{ /* fields omitted */ }

The slot generator.

Methods

impl<T> SlotGenerator<T> where
    T: PrimInt,
    Range<T>: ExactSizeIterator
[src]

pub fn new(range: Range<T>) -> SlotGenerator<T>[src]

Create a new SlotGenerator with the specified range.

pub fn generate_slot(&mut self) -> T[src]

Generate a new slot.

Panics

Will panic if no more slots are available.

pub fn try_generate_slot(&mut self) -> Option<T>[src]

Attempts to generate a new slot.

Will return None if no slots are available.

pub fn replace_slot(&mut self, slot: T) where
    T: Debug
[src]

Reclaim a slot that has been generated by the SlotGenerator.

Panics

Will panic if the slot is already in the slot pool.

pub fn try_replace_slot(&mut self, slot: T) -> Result<(), T>[src]

Attempt to reclaim a slot that has been generated by the SlotGenerator.

Will return Err(slot) if the slot is already in the slot pool.

Trait Implementations

impl<T: Clone> Clone for SlotGenerator<T> where
    T: PrimInt,
    Range<T>: ExactSizeIterator
[src]

impl<T: Debug> Debug for SlotGenerator<T> where
    T: PrimInt,
    Range<T>: ExactSizeIterator
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for SlotGenerator<T> where
    T: RefUnwindSafe

impl<T> Send for SlotGenerator<T> where
    T: Send

impl<T> Sync for SlotGenerator<T> where
    T: Sync

impl<T> Unpin for SlotGenerator<T> where
    T: Unpin

impl<T> UnwindSafe for SlotGenerator<T> where
    T: UnwindSafe

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<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.