pub struct AtomicLendCell<T> { /* private fields */ }Expand description
A container that allows thread-safe lending of its contained value using epoch-based reclamation
AtomicLendCell<T> owns a value of type T and maintains an atomic boolean
to track its lifetime. It ensures that the value isn’t accessed after being dropped,
with validation occurring in debug builds.
Implementations§
Source§impl<T> AtomicLendCell<T>
impl<T> AtomicLendCell<T>
Source§impl<T> AtomicLendCell<T>
impl<T> AtomicLendCell<T>
Sourcepub fn new(data: T) -> Self
pub fn new(data: T) -> Self
Creates a new AtomicLendCell containing the given value
§Examples
use atomic_lend_cell::AtomicLendCell;
let cell = AtomicLendCell::new(42);Sourcepub fn borrow(&self) -> AtomicBorrowCell<T>
pub fn borrow(&self) -> AtomicBorrowCell<T>
Creates a new AtomicBorrowCell for the contained value
This returns a borrow that can be sent to other threads. The borrow will verify the owner’s liveness in debug builds.
§Examples
use atomic_lend_cell::AtomicLendCell;
let cell = AtomicLendCell::new(42);
let borrow = cell.borrow();
assert_eq!(*borrow, 42);Source§impl<'a, T> AtomicLendCell<&'a T>
impl<'a, T> AtomicLendCell<&'a T>
Sourcepub fn borrow_deref(&'a self) -> AtomicBorrowCell<T>
pub fn borrow_deref(&'a self) -> AtomicBorrowCell<T>
Creates a new AtomicBorrowCell that borrows the referenced value directly
This is useful when the AtomicLendCell contains a reference, and you want to
borrow the underlying value rather than the reference itself.
Trait Implementations§
Source§impl<T> Deref for AtomicLendCell<T>
impl<T> Deref for AtomicLendCell<T>
Auto Trait Implementations§
impl<T> !Freeze for AtomicLendCell<T>
impl<T> RefUnwindSafe for AtomicLendCell<T>where
T: RefUnwindSafe,
impl<T> Send for AtomicLendCell<T>where
T: Send,
impl<T> Sync for AtomicLendCell<T>where
T: Sync,
impl<T> Unpin for AtomicLendCell<T>where
T: Unpin,
impl<T> UnwindSafe for AtomicLendCell<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