pub struct Pool<T> { /* private fields */ }
Expand description
Container for objects that can be taken out.
Implementations§
Source§impl<T> Pool<T>
impl<T> Pool<T>
Sourcepub fn new(items: impl IntoIterator<Item = T>) -> Self
pub fn new(items: impl IntoIterator<Item = T>) -> Self
Construct a new Pool with the items from the iterator.
Sourcepub fn take(&self) -> Returnable<'_, T>
pub fn take(&self) -> Returnable<'_, T>
Remove an item from the pool, this will take the “oldest” item.
The item will automatically get returned to the pool when the smart pointer is dropped.
There is no “resetting” that is common in other frameworks. You need to perform any resetting on your own.
Auto Trait Implementations§
impl<T> !Freeze for Pool<T>
impl<T> RefUnwindSafe for Pool<T>
impl<T> Send for Pool<T>where
T: Send,
impl<T> Sync for Pool<T>where
T: Send,
impl<T> Unpin for Pool<T>where
T: Unpin,
impl<T> UnwindSafe for Pool<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