Struct atomic_borrow::AtomicBorrow
source · #[repr(transparent)]pub struct AtomicBorrow { /* private fields */ }Expand description
An atomic reference counter.
Implementations
sourceimpl 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
sourceimpl Debug for AtomicBorrow
impl Debug for AtomicBorrow
sourceimpl Default for AtomicBorrow
impl Default for AtomicBorrow
sourcefn default() -> AtomicBorrow
fn default() -> AtomicBorrow
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for AtomicBorrow
impl Send for AtomicBorrow
impl Sync for AtomicBorrow
impl Unpin for AtomicBorrow
impl UnwindSafe for AtomicBorrow
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more