[][src]Enum reclaim::Marked

pub enum Marked<T: NonNullable> {
    Value(T),
    Null(usize),
}

A value that represents the possible states of a nullable marked pointer.

This type is similar to Option<T> but can also express null pointers with mark bits.

Variants

Value(T)

A marked, non-nullable pointer or reference value.

Null(usize)

A null pointer that may be marked, in which case the usize is non-zero.

Methods

impl<T: NonNullable> Marked<T>[src]

pub fn is_value(&self) -> bool[src]

Returns true if the marked value contains a Value.

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

Returns true if the marked value is a Null.

pub fn as_ref(&self) -> Marked<&T>[src]

Converts from Marked<T> to Marked<&T>.

pub fn as_mut(&mut self) -> Marked<&mut T>[src]

Converts from Marked<T> to Marked<&mut T>.

pub fn unwrap_value(self) -> T[src]

Moves the pointer out of the Marked if it is Value(ptr).

pub fn unwrap_null(self) -> usize[src]

Extracts the tag out of the Marked if it is Null(tag).

pub fn unwrap_value_or_else(self, func: impl FnOnce(usize) -> T) -> T[src]

Returns the contained value or the result of the given func.

pub fn map<U: NonNullable>(self, func: impl FnOnce(T) -> U) -> Marked<U>[src]

Maps a Marked<T> to Marked<U> by applying a function to a contained value.

pub fn map_or_else<U: NonNullable>(
    self,
    default: impl FnOnce(usize) -> U,
    func: impl FnOnce(T) -> U
) -> U
[src]

Applies a function to the contained value (if any), or computes a default value using func, if no value is contained.

pub fn value(self) -> Option<T>[src]

Converts self from Marked<T> to Option<T>.

pub fn take(&mut self) -> Self[src]

Takes the value of the Marked, leaving a Null variant in its place.

pub fn replace(&mut self, value: T) -> Self[src]

Replaces the actual value in the Marked with the given value, returning the old value.

impl<T: NonNullable + MarkedPointer> Marked<T>[src]

pub fn decompose_tag(&self) -> usize[src]

Decomposes the inner marked pointer, returning only the separated tag.

Trait Implementations

impl<U, T, N: Unsigned> MarkedPointer for Marked<U> where
    U: MarkedPointer<Pointer = U, Item = T, MarkBits = N> + NonNullable<Item = T, MarkBits = N>, 
[src]

type Pointer = U

The pointer type.

type Item = T

The pointed-to type.

type MarkBits = N

Number of bits available for tagging.

impl<T: NonNullable> From<Option<T>> for Marked<T>[src]

impl<T: PartialEq + NonNullable> PartialEq<Marked<T>> for Marked<T>[src]

impl<T: Clone + NonNullable> Clone for Marked<T>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: NonNullable> Default for Marked<T>[src]

impl<T: PartialOrd + NonNullable> PartialOrd<Marked<T>> for Marked<T>[src]

impl<T: Eq + NonNullable> Eq for Marked<T>[src]

impl<T: Ord + NonNullable> Ord for Marked<T>[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<T: Copy + NonNullable> Copy for Marked<T>[src]

impl<T: Debug + NonNullable> Debug for Marked<T>[src]

Auto Trait Implementations

impl<T> Unpin for Marked<T> where
    T: Unpin

impl<T> Sync for Marked<T> where
    T: Sync

impl<T> Send for Marked<T> where
    T: Send

impl<T> RefUnwindSafe for Marked<T> where
    T: RefUnwindSafe

impl<T> UnwindSafe for Marked<T> where
    T: UnwindSafe

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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.

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

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

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

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

type Output = T

Should always be Self