[−][src]Enum reclaim::prelude::Marked
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]
self,
default: impl FnOnce(usize) -> U,
func: impl FnOnce(T) -> U
) -> U
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]
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]
U: MarkedPointer<Pointer = U, Item = T, MarkBits = N> + NonNullable<Item = T, MarkBits = N>,
type Pointer = U
The pointer type.
type Item = T
The pointed-to type.
type MarkBits = N
Number of bits available for tagging.
fn as_marked_ptr(&self) -> MarkedPtr<Self::Item, Self::MarkBits>
[src]
fn into_marked_ptr(self) -> MarkedPtr<Self::Item, Self::MarkBits>
[src]
fn marked(marked: Self, tag: usize) -> Marked<Self::Pointer>
[src]
fn unmarked(marked: Self) -> Self
[src]
fn decompose(marked: Self) -> (Self, usize)
[src]
unsafe fn from_marked_ptr(marked: MarkedPtr<Self::Item, Self::MarkBits>) -> Self
[src]
unsafe fn from_marked_non_null(
marked: MarkedNonNull<Self::Item, Self::MarkBits>
) -> Self
[src]
marked: MarkedNonNull<Self::Item, Self::MarkBits>
) -> Self
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(&self) -> 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]
fn partial_cmp(&self, other: &Marked<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &Marked<T>) -> bool
[src]
fn le(&self, other: &Marked<T>) -> bool
[src]
fn gt(&self, other: &Marked<T>) -> bool
[src]
fn ge(&self, other: &Marked<T>) -> bool
[src]
impl<T: Eq + NonNullable> Eq for Marked<T>
[src]
impl<T: Ord + NonNullable> Ord for Marked<T>
[src]
fn cmp(&self, other: &Marked<T>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
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,
T: Unpin,
impl<T> Sync for Marked<T> where
T: Sync,
T: Sync,
impl<T> Send for Marked<T> where
T: Send,
T: Send,
impl<T> RefUnwindSafe for Marked<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> UnwindSafe for Marked<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self