pub struct Object<T> { /* private fields */ }
Expand description
Wrapper around the actual pooled object which implements Deref
,
DerefMut
and Drop
traits.
Use this object just as if it was of type T
and upon leaving a scope the
Drop::drop()
will take care of returning it to the pool.
Implementations§
source§impl<T> Object<T>
impl<T> Object<T>
sourcepub fn take(this: Self) -> T
pub fn take(this: Self) -> T
Takes this object from the pool permanently. This reduces the size of
the pool. If needed, the object can later be added back to the pool
using the Pool::add()
or Pool::try_add()
methods.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Object<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Object<T>
impl<T> Send for Object<T>where
T: Send,
impl<T> Sync for Object<T>
impl<T> Unpin for Object<T>where
T: Unpin,
impl<T> !UnwindSafe for Object<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