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: RThe index must be either Cell<usize> or AtomicUsize
pools: PThe 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]>
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>>
fn insert(&self, scalar: OpaqueScalar<A>) -> Option<OpaqueScalar<A>>
Put a new id into the pool
Source§fn remove(&self) -> Option<OpaqueScalar<A>>
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]>
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>>
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>>
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>
impl<R, P> RefUnwindSafe for Sequence<R, P>
impl<R, P> Send for Sequence<R, P>
impl<R, P> Sync for Sequence<R, P>
impl<R, P> Unpin for Sequence<R, P>
impl<R, P> UnwindSafe for Sequence<R, P>
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