Struct fpool::RoundRobinPool [−][src]
pub struct RoundRobinPool<T, TCError> { /* fields omitted */ }
A Pool
that uses round-robin logic to retrieve items
in the pool. Can be converted into the items with the into_items()
function.
Methods
impl<T, TCError> RoundRobinPool<T, TCError>
[src]
impl<T, TCError> RoundRobinPool<T, TCError>
pub fn builder<F: 'static + Fn() -> Result<T, TCError>>(
pool_size: usize,
constructor: F
) -> Builder<RoundRobinPool<T, TCError>>
[src]
pub fn builder<F: 'static + Fn() -> Result<T, TCError>>(
pool_size: usize,
constructor: F
) -> Builder<RoundRobinPool<T, TCError>>
Get the builder for the pool.
pub fn get(&mut self) -> Result<&mut ItemHandle<T>, TCError>
[src]
pub fn get(&mut self) -> Result<&mut ItemHandle<T>, TCError>
Pass-through call to the Pool
trait's get()
.
Items are re-used unless invalid, in which case they are re-constructed.
If the construction fails, then the error is returned. Do not hold on
to the ItemHandle reference, as it may be returned by a subsequent call on get()
.
pub fn size(&self) -> usize
[src]
pub fn size(&self) -> usize
pub fn into_items(
self
) -> impl Iterator<Item = T>
[src]
pub fn into_items(
self
) -> impl Iterator<Item = T>
pub fn items_iter(
&self
) -> impl Iterator<Item = &T>
[src]
pub fn items_iter(
&self
) -> impl Iterator<Item = &T>
pub fn items_iter_mut(
&mut self
) -> impl Iterator<Item = &mut T>
[src]
pub fn items_iter_mut(
&mut self
) -> impl Iterator<Item = &mut T>
Trait Implementations
impl<T, TCError> Pool for RoundRobinPool<T, TCError>
[src]
impl<T, TCError> Pool for RoundRobinPool<T, TCError>
type Item = T
type ConstructionError = TCError
fn get(&mut self) -> Result<&mut ItemHandle<T>, TCError>
[src]
fn get(&mut self) -> Result<&mut ItemHandle<T>, TCError>
Items are re-used unless invalid, in which case they are re-constructed. If the construction fails, then the error is returned. Do not hold on to the ItemHandle reference, as it may be returned by a subsequent call on get()
. Read more
Auto Trait Implementations
impl<T, TCError> !Send for RoundRobinPool<T, TCError>
impl<T, TCError> !Send for RoundRobinPool<T, TCError>
impl<T, TCError> !Sync for RoundRobinPool<T, TCError>
impl<T, TCError> !Sync for RoundRobinPool<T, TCError>