Sequence

Struct Sequence 

Source
pub struct Sequence<R, P: ?Sized> {
    pub index: R,
    pub pools: P,
}
Expand description

A Pool that iterates over it’s elements and tries to put a given OpaqueScalar into one of it’s sub-pools. May fail if it can’t put an element into any of it’s pools

i.e.

let sequence = Sequence {
    index: Cell::new(0),
    pools: [Cell::new(None), Cell::new(None), Cell::new(None), Cell::new(None)],
};
let sequence: &Sequence<Cell<usize>, [Cell<Option<OpaqueScalar<_>>>]> = &sequence;
let dynamic = ThreadLocal::with_pool(sequence);

Fields§

§index: R

The index must be either Cell<usize> or AtomicUsize

§pools: P

The pools must have the type [P] where P is a pool

This type is generic, so that it’s possible to create it with safe code

Trait Implementations§

Source§

impl<A: ScalarAllocator, R: Radium<Item = usize>, P: Pool<A>> Pool<A> for Sequence<R, [P]>

Source§

fn insert(&self, scalar: OpaqueScalar<A>) -> Option<OpaqueScalar<A>>

Put a new id into the pool
Source§

fn remove(&self) -> Option<OpaqueScalar<A>>

Take an id out of the pool
Source§

impl<A: ScalarAllocator, R: Radium<Item = usize>, P: PoolMut<A>> PoolMut<A> for Sequence<R, [P]>

Source§

fn insert_mut(&mut self, scalar: OpaqueScalar<A>) -> Option<OpaqueScalar<A>>

Put a new id into the pool
Source§

fn remove_mut(&mut self) -> Option<OpaqueScalar<A>>

Take an id out of the pool

Auto Trait Implementations§

§

impl<R, P> Freeze for Sequence<R, P>
where R: Freeze, P: Freeze + ?Sized,

§

impl<R, P> RefUnwindSafe for Sequence<R, P>

§

impl<R, P> Send for Sequence<R, P>
where R: Send, P: Send + ?Sized,

§

impl<R, P> Sync for Sequence<R, P>
where R: Sync, P: Sync + ?Sized,

§

impl<R, P> Unpin for Sequence<R, P>
where R: Unpin, P: Unpin + ?Sized,

§

impl<R, P> UnwindSafe for Sequence<R, P>
where R: UnwindSafe, P: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.