#[repr(transparent)]pub struct TaggedPointer<T: ?Sized> {
pub raw: *mut T,
}Expand description
Structure wrapping a raw, tagged pointer.
Fields§
§raw: *mut TImplementations§
Source§impl<T> TaggedPointer<T>
impl<T> TaggedPointer<T>
Sourcepub fn new(raw: *mut T) -> TaggedPointer<T>
pub fn new(raw: *mut T) -> TaggedPointer<T>
Returns a new TaggedPointer without setting any bits.
Sourcepub fn with_bit(raw: *mut T, bit: usize) -> TaggedPointer<T>
pub fn with_bit(raw: *mut T, bit: usize) -> TaggedPointer<T>
Returns a new TaggedPointer with the given bit set.
pub fn unset_bit(&mut self, bit: usize)
Sourcepub const fn null() -> TaggedPointer<T>
pub const fn null() -> TaggedPointer<T>
Returns a null pointer.
Returns a new TaggedPointer using the current pointer but without any tags.
Sourcepub fn bit_is_set(self, bit: usize) -> bool
pub fn bit_is_set(self, bit: usize) -> bool
Returns true if the given bit is set.
Sourcepub fn as_mut<'a>(self) -> Option<&'a mut T>
pub fn as_mut<'a>(self) -> Option<&'a mut T>
Returns a mutable reference to the pointer’s value.
Sourcepub fn compare_and_swap(&self, current: *mut T, other: *mut T) -> bool
pub fn compare_and_swap(&self, current: *mut T, other: *mut T) -> bool
Atomically swaps the internal pointer with another one.
This boolean returns true if the pointer was swapped, false otherwise.
Sourcepub fn atomic_store(&self, other: *mut T)
pub fn atomic_store(&self, other: *mut T)
Atomically replaces the current pointer with the given one.
Sourcepub fn atomic_load(&self) -> *mut T
pub fn atomic_load(&self) -> *mut T
Atomically loads the pointer.
Sourcepub fn atomic_bit_is_set(&self, bit: usize) -> bool
pub fn atomic_bit_is_set(&self, bit: usize) -> bool
Checks if a bit is set using an atomic load.
Trait Implementations§
Source§impl<T> Clone for TaggedPointer<T>
impl<T> Clone for TaggedPointer<T>
Source§fn clone(&self) -> TaggedPointer<T>
fn clone(&self) -> TaggedPointer<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Hash for TaggedPointer<T>
impl<T> Hash for TaggedPointer<T>
Source§impl<T> PartialEq for TaggedPointer<T>
impl<T> PartialEq for TaggedPointer<T>
impl<T> Copy for TaggedPointer<T>
impl<T> Eq for TaggedPointer<T>
Auto Trait Implementations§
impl<T> Freeze for TaggedPointer<T>where
T: ?Sized,
impl<T> RefUnwindSafe for TaggedPointer<T>where
T: RefUnwindSafe + ?Sized,
impl<T> !Send for TaggedPointer<T>
impl<T> !Sync for TaggedPointer<T>
impl<T> Unpin for TaggedPointer<T>where
T: ?Sized,
impl<T> UnsafeUnpin for TaggedPointer<T>where
T: ?Sized,
impl<T> UnwindSafe for TaggedPointer<T>where
T: RefUnwindSafe + ?Sized,
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