pub struct AtomicBorrow { /* private fields */ }Expand description
An atomic reference counter.
Implementations§
Source§impl AtomicBorrow
impl AtomicBorrow
Sourcepub const SHARED_MASK: usize = 9_223_372_036_854_775_807usize
pub const SHARED_MASK: usize = 9_223_372_036_854_775_807usize
The mask for the shared borrow count.
Sourcepub const UNIQUE_MASK: usize = 9_223_372_036_854_775_808usize
pub const UNIQUE_MASK: usize = 9_223_372_036_854_775_808usize
The mask for the unique borrow bit.
Returns number of shared borrows.
Sourcepub fn is_borrowed(&self) -> bool
pub fn is_borrowed(&self) -> bool
Returns true if self is borrowed in any way.
Sourcepub fn borrow(&self) -> bool
pub fn borrow(&self) -> bool
Tries to acquire a shared reference.
Returns true if the reference was acquired.
Sourcepub fn borrow_mut(&self) -> bool
pub fn borrow_mut(&self) -> bool
Tries to acquire a unique reference.
Returns true if the reference was acquired.
Sourcepub fn release(&self)
pub fn release(&self)
Releases a shared reference.
§Panics.
- If
selfis not borrowed. Only withdebug_assertionsenabled. - If
selfis uniquely borrowed. Only withdebug_assertionsenabled.
Sourcepub fn release_mut(&self)
pub fn release_mut(&self)
Releases a unique reference.
§Panics.
- If
selfis not uniquely borrowed. Only withdebug_assertionsenabled.
Sourcepub fn spin_borrow(&self)
pub fn spin_borrow(&self)
Spins until a shared reference can be acquired.
Sourcepub fn spin_borrow_mut(&self)
pub fn spin_borrow_mut(&self)
Spins until a unique reference can be acquired.
Trait Implementations§
Source§impl Debug for AtomicBorrow
impl Debug for AtomicBorrow
Source§impl Default for AtomicBorrow
impl Default for AtomicBorrow
Source§fn default() -> AtomicBorrow
fn default() -> AtomicBorrow
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for AtomicBorrow
impl RefUnwindSafe for AtomicBorrow
impl Send for AtomicBorrow
impl Sync for AtomicBorrow
impl Unpin for AtomicBorrow
impl UnwindSafe for AtomicBorrow
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