Struct simple_pool::ResourcePool
source · pub struct ResourcePool<T> {
pub holder: Arc<Mutex<ResourceHolder<T>>>,
}Expand description
Versatile resource pool
Fields§
§holder: Arc<Mutex<ResourceHolder<T>>>Implementations§
source§impl<T> ResourcePool<T>
impl<T> ResourcePool<T>
sourcepub fn with_capacity(size: usize) -> Self
pub fn with_capacity(size: usize) -> Self
Create a new resource pool with pre-allocated capacity
The size parameter is used to pre-allocate memory for the resource holder only
sourcepub fn get(&self) -> impl Future<Output = ResourcePoolGuard<T>> + '_
pub fn get(&self) -> impl Future<Output = ResourcePoolGuard<T>> + '_
Get a resource from the pool or wait until one is available
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for ResourcePool<T>
impl<T> Send for ResourcePool<T>where T: Send,
impl<T> Sync for ResourcePool<T>where T: Send,
impl<T> Unpin for ResourcePool<T>
impl<T> !UnwindSafe for ResourcePool<T>
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