[][src]Struct cgc::mem::TaggedPointer

#[repr(transparent)]pub struct TaggedPointer<T: ?Sized> {
    pub raw: *mut T,
}

Structure wrapping a raw, tagged pointer.

Fields

raw: *mut T

Methods

impl<T> TaggedPointer<T>[src]

pub fn new(raw: *mut T) -> TaggedPointer<T>[src]

Returns a new TaggedPointer without setting any bits.

pub fn with_bit(raw: *mut T, bit: usize) -> TaggedPointer<T>[src]

Returns a new TaggedPointer with the given bit set.

pub fn unset_bit(&mut self, bit: usize)[src]

pub const fn null() -> TaggedPointer<T>[src]

Returns a null pointer.

pub fn untagged(self) -> *mut T[src]

Returns the wrapped pointer without any tags.

pub fn without_tags(self) -> Self[src]

Returns a new TaggedPointer using the current pointer but without any tags.

pub fn bit_is_set(self, bit: usize) -> bool[src]

Returns true if the given bit is set.

pub fn set_bit(&mut self, bit: usize)[src]

Sets the given bit.

pub fn is_null(self) -> bool[src]

Returns true if the current pointer is a null pointer.

pub fn as_ref<'a>(self) -> Option<&'a T>[src]

Returns an immutable to the pointer's value.

pub fn as_mut<'a>(self) -> Option<&'a mut T>[src]

Returns a mutable reference to the pointer's value.

pub fn compare_and_swap(&self, current: *mut T, other: *mut T) -> bool[src]

Atomically swaps the internal pointer with another one.

This boolean returns true if the pointer was swapped, false otherwise.

pub fn atomic_store(&self, other: *mut T)[src]

Atomically replaces the current pointer with the given one.

pub fn atomic_load(&self) -> *mut T[src]

Atomically loads the pointer.

pub fn atomic_bit_is_set(&self, bit: usize) -> bool[src]

Checks if a bit is set using an atomic load.

Trait Implementations

impl<T> Clone for TaggedPointer<T>[src]

impl<T> Copy for TaggedPointer<T>[src]

impl<T: Debug + ?Sized> Debug for TaggedPointer<T>[src]

impl<T> Eq for TaggedPointer<T>[src]

impl<T> Hash for TaggedPointer<T>[src]

impl<T> PartialEq<TaggedPointer<T>> for TaggedPointer<T>[src]

Auto Trait Implementations

impl<T: ?Sized> RefUnwindSafe for TaggedPointer<T> where
    T: RefUnwindSafe

impl<T> !Send for TaggedPointer<T>

impl<T> !Sync for TaggedPointer<T>

impl<T: ?Sized> Unpin for TaggedPointer<T>

impl<T: ?Sized> UnwindSafe for TaggedPointer<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.