pub struct ResourcePool<T> { /* private fields */ }Expand description
Pool of resources with acquire/release semantics.
Implementations§
Source§impl<T: Clone> ResourcePool<T>
impl<T: Clone> ResourcePool<T>
pub fn new(resources: Vec<T>) -> Self
pub fn acquire(&mut self) -> Option<usize>
pub fn release(&mut self, index: usize) -> bool
pub fn get(&self, index: usize) -> Option<&T>
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
pub fn is_in_use(&self, index: usize) -> bool
pub fn available_count(&self) -> usize
pub fn in_use_count(&self) -> usize
pub fn total_count(&self) -> usize
pub fn borrow_count(&self, index: usize) -> u32
pub fn release_all(&mut self)
pub fn total_borrows(&self) -> u64
Auto Trait Implementations§
impl<T> Freeze for ResourcePool<T>
impl<T> RefUnwindSafe for ResourcePool<T>where
T: RefUnwindSafe,
impl<T> Send for ResourcePool<T>where
T: Send,
impl<T> Sync for ResourcePool<T>where
T: Sync,
impl<T> Unpin for ResourcePool<T>where
T: Unpin,
impl<T> UnsafeUnpin for ResourcePool<T>
impl<T> UnwindSafe for ResourcePool<T>where
T: UnwindSafe,
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