[−][src]Struct fpool::RoundRobinPool
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]
pub fn builder<F: 'static + Send + Fn() -> Result<T, TCError>>(
pool_size: usize,
constructor: F
) -> Builder<RoundRobinPool<T, TCError>>
[src]
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]
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 into_items(self) -> impl Iterator<Item = T>
[src]
pub fn items_iter(&self) -> impl Iterator<Item = &T>
[src]
pub fn items_iter_mut(&mut self) -> impl Iterator<Item = &mut T>
[src]
Trait Implementations
impl<T, TCError> Pool for RoundRobinPool<T, TCError>
[src]
type Item = T
type ConstructionError = TCError
fn get(&mut self) -> Result<&mut ItemHandle<T>, TCError>
[src]
Auto Trait Implementations
impl<T, TCError> !RefUnwindSafe for RoundRobinPool<T, TCError>
impl<T, TCError> Send for RoundRobinPool<T, TCError> where
T: Send,
T: Send,
impl<T, TCError> !Sync for RoundRobinPool<T, TCError>
impl<T, TCError> Unpin for RoundRobinPool<T, TCError> where
T: Unpin,
T: Unpin,
impl<T, TCError> !UnwindSafe for RoundRobinPool<T, TCError>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,