Struct lease::Pool [−][src]
#[must_use]pub struct Pool<T> { /* fields omitted */ }
Expand description
A pool of objects of type T
that can be leased out.
This struct implements std::iter::FromIterator
so you can create it from an iterator
by calling std::iter::Iterator::collect()
Implementations
Creates a new Pool
with an initial size of pool_size
by calling init
pool_size
times.
pub fn get_async(&self) -> AsyncLease<T>ⓘNotable traits for AsyncLease<T>
impl<'a, T> Future for AsyncLease<T> type Output = Lease<T>;
[src]
pub fn get_async(&self) -> AsyncLease<T>ⓘNotable traits for AsyncLease<T>
impl<'a, T> Future for AsyncLease<T> type Output = Lease<T>;
[src]Returns a future that resolves to a Lease
when one is available
Tries to get a Lease
if one is available. This function does not block.
Returns a struct that implements the futures_core::Stream
trait.
Tries to get an existing Lease
if available and if not returns a new one that has been added to the pool.
Calling this method repeatedly can cause the pool size to increase without bound.
Just like get_or_new()
but caps the size of the pool. Once len()
== cap
then None
is returned.
Sets the size of the pool to zero
This will disassociate all current Lease
es and when they go out of scope the objects they’re
holding will be dropped
Resizes the pool to pool_size
init
is only called if the pool needs to grow.
Disassociates the returned [‘Lease’] from this Pool
Just like get_or_new()
but uses Default::default()
as the init
function
Just like get_or_new_with_cap()
but uses Default::default()
as the init
function
Just like resize()
but uses Default::default()
as the init
function
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Pool<T>
impl<T> !UnwindSafe for Pool<T>
Blanket Implementations
Mutably borrows from an owned value. Read more