pub struct MutexReusable<'a, T> { /* private fields */ }
Expand description
Wrapper over T used by MutexObjectPool
.
Access is allowed with std::ops::Deref
or std::ops::DerefMut
§Example
use lockfree_object_pool::MutexObjectPool;
let pool = MutexObjectPool::<u32>::new(
|| Default::default(),
|v| {
*v = 0;
}
);
let mut item = pool.pull();
*item = 5;
let work = *item * 5;
Implementations§
Source§impl<'a, T> MutexReusable<'a, T>
impl<'a, T> MutexReusable<'a, T>
Sourcepub fn new(pool: &'a MutexObjectPool<T>, data: ManuallyDrop<T>) -> Self
pub fn new(pool: &'a MutexObjectPool<T>, data: ManuallyDrop<T>) -> Self
Trait Implementations§
Source§impl<'a, T> Deref for MutexReusable<'a, T>
impl<'a, T> Deref for MutexReusable<'a, T>
Source§impl<'a, T> DerefMut for MutexReusable<'a, T>
impl<'a, T> DerefMut for MutexReusable<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for MutexReusable<'a, T>where
T: Freeze,
impl<'a, T> !RefUnwindSafe for MutexReusable<'a, T>
impl<'a, T> Send for MutexReusable<'a, T>where
T: Send,
impl<'a, T> Sync for MutexReusable<'a, T>
impl<'a, T> Unpin for MutexReusable<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for MutexReusable<'a, 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