[−][src]Struct reclaim::MarkedNonNull
A non-nullable marked raw pointer type like NonNull
.
Note, that unlike MarkedPtr
this also excludes marked
null-pointers.
Methods
impl<T, N> MarkedNonNull<T, N>
[src]
pub const fn cast<U>(self) -> MarkedNonNull<U, N>
[src]
Cast to a pointer of another type.
pub const fn dangling() -> Self
[src]
Creates a new MarkedNonNull
that is dangling, but well-aligned.
This is useful for initializing types which lazily allocate, like
Vec::new
does.
Note that the pointer value may potentially represent a valid pointer to
a T
, which means this must not be used as a "not yet initialized"
sentinel value. Types that lazily allocate must track initialization by
some other means.
impl<T, N: Unsigned> MarkedNonNull<T, N>
[src]
pub const MARK_BITS: usize
[src]
The number of available mark bits for this type.
pub const MARK_MASK: usize
[src]
The bitmask for the lower markable bits.
pub const POINTER_MASK: usize
[src]
The bitmask for the (higher) pointer bits.
pub fn into_non_null(self) -> NonNull<T>
[src]
Returns the inner pointer as is, meaning potential tags are not stripped.
pub fn convert<M: Unsigned>(other: MarkedNonNull<T, M>) -> Self where
N: IsGreaterOrEqual<M, Output = True>,
[src]
N: IsGreaterOrEqual<M, Output = True>,
Converts a marked non-null pointer with M
potential mark bits to the
same marked pointer with N
potential mark bits, requires that
N >= M
.
pub unsafe fn new_unchecked(ptr: MarkedPtr<T, N>) -> Self
[src]
Creates a new MarkedNonNull
from a marked pointer without checking
for null
.
Safety
ptr
may be marked, but must be be neither an unmarked nor a marked
null pointer.
pub fn new(ptr: MarkedPtr<T, N>) -> Marked<Self>
[src]
Creates a new MarkedNonNull
wrapped in a Marked
if ptr
is
non-null.
pub fn clear_tag(self) -> Self
[src]
Clears the tag of self
and returns the same but untagged pointer.
pub fn with_tag(self, tag: usize) -> Self
[src]
Clears the tag of self
and replaces it with tag
.
pub fn into_marked_ptr(self) -> MarkedPtr<T, N>
[src]
Converts the pointer to the equivalent MarkedPtr
.
pub fn compose(ptr: NonNull<T>, tag: usize) -> Self
[src]
Composes a new marked non-null pointer from a non-null pointer and a tag value.
pub fn decompose(self) -> (NonNull<T>, usize)
[src]
Decomposes the marked pointer, returning the separated raw
NonNull
pointer and its tag.
pub fn decompose_ptr(self) -> *mut T
[src]
Decomposes the marked pointer, returning only the separated raw pointer.
pub fn decompose_non_null(self) -> NonNull<T>
[src]
Decomposes the marked pointer, returning only the separated raw
NonNull
pointer.
pub fn decompose_tag(self) -> usize
[src]
Decomposes the marked pointer, returning only the separated tag.
pub unsafe fn decompose_ref(&self) -> (&T, usize)
[src]
Decomposes the marked pointer, dereferences the the raw pointer and returns both the reference and the separated tag.
The resulting lifetime is bound to self so this behaves "as if"
it were actually an instance of T that is getting borrowed. If a longer
(unbound) lifetime is needed, use e.g. &*my_ptr.decompose_ptr()
.
Safety
This is unsafe because it cannot verify the validity of the returned pointer.
pub unsafe fn decompose_ref_unbounded<'a>(self) -> (&'a T, usize)
[src]
Decomposes the marked pointer, dereferences the the raw pointer and
returns both the reference and the separated tag. The returned reference
is not bound to the lifetime of the MarkedNonNull
.
Safety
This is unsafe because it cannot verify the validity of the returned
pointer, nor can it ensure that the lifetime 'a
returned is indeed a
valid lifetime for the contained data.
pub unsafe fn decompose_mut(&mut self) -> (&mut T, usize)
[src]
Decomposes the marked pointer, mutably dereferences the the raw pointer and returns both the mutable reference and the separated tag.
The resulting lifetime is bound to self so this behaves "as if"
it were actually an instance of T that is getting borrowed. If a longer
(unbound) lifetime is needed, use e.g. &mut *my_ptr.decompose_ptr()
.
Safety
This is unsafe because it cannot verify the validity of the returned pointer.
pub unsafe fn decompose_mut_unbounded<'a>(&mut self) -> (&'a mut T, usize)
[src]
Decomposes the marked pointer, mutably dereferences the the raw pointer
and returns both the mutable reference and the separated tag. The
returned reference is not bound to the lifetime of the MarkedNonNull
.
Safety
This is unsafe because it cannot verify the validity of the returned
pointer, nor can it ensure that the lifetime 'a
returned is indeed a
valid lifetime for the contained data.
pub unsafe fn as_ref(&self) -> &T
[src]
Decomposes the marked pointer, returning only the de-referenced raw pointer.
The resulting lifetime is bound to self so this behaves "as if" it were
actually an instance of T that is getting borrowed. If a longer
(unbound) lifetime is needed, use e.g. &*my_ptr.decompose_ptr()
or as_ref_unbounded
.
Safety
This is unsafe because it cannot verify the validity of the returned pointer.
pub unsafe fn as_ref_unbounded<'a>(self) -> &'a T
[src]
Decomposes the marked pointer, returning only the de-referenced raw
pointer, which is not bound to the lifetime of the MarkedNonNull
.
Safety
This is unsafe because it cannot verify the validity of the returned
pointer, nor can it ensure that the lifetime 'a
returned is indeed a
valid lifetime for the contained data.
pub unsafe fn as_mut(&mut self) -> &mut T
[src]
Decomposes the marked pointer, returning only the mutably de-referenced raw pointer.
The resulting lifetime is bound to self so this behaves "as if"
it were actually an instance of T that is getting borrowed. If a longer
(unbound) lifetime is needed, use e.g. &mut *my_ptr.decompose_ptr()
or as_mut_unbounded
.
Safety
This is unsafe because it cannot verify the validity of the returned pointer.
pub unsafe fn as_mut_unbounded<'a>(self) -> &'a mut T
[src]
Decomposes the marked pointer, returning only the mutably de-referenced
raw pointer, which is not bound to the lifetime of the MarkedNonNull
.
Safety
This is unsafe because it cannot verify the validity of the returned
pointer, nor can it ensure that the lifetime 'a
returned is indeed a
valid lifetime for the contained data.
Trait Implementations
impl<T, N: Unsigned> NonNullable for MarkedNonNull<T, N>
[src]
type Item = T
The pointed-to type.
type MarkBits = N
Number of bits available for tagging.
fn into_marked_non_null(self) -> MarkedNonNull<Self::Item, Self::MarkBits>
[src]
impl<T, N> PartialOrd<MarkedNonNull<T, N>> for MarkedNonNull<T, N>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T, N> PartialOrd<MarkedPtr<T, N>> for MarkedNonNull<T, N>
[src]
fn partial_cmp(&self, other: &MarkedPtr<T, N>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T, N> PartialOrd<MarkedNonNull<T, N>> for MarkedPtr<T, N>
[src]
fn partial_cmp(&self, other: &MarkedNonNull<T, N>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T, N> PartialEq<MarkedNonNull<T, N>> for MarkedNonNull<T, N>
[src]
fn eq(&self, other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T, N> PartialEq<MarkedPtr<T, N>> for MarkedNonNull<T, N>
[src]
fn eq(&self, other: &MarkedPtr<T, N>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T, N> PartialEq<MarkedNonNull<T, N>> for MarkedPtr<T, N>
[src]
fn eq(&self, other: &MarkedNonNull<T, N>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T, N> Copy for MarkedNonNull<T, N>
[src]
impl<T, N> Ord for MarkedNonNull<T, N>
[src]
fn cmp(&self, other: &Self) -> 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, N> Eq for MarkedNonNull<T, N>
[src]
impl<T, N> From<NonNull<T>> for MarkedNonNull<T, N>
[src]
impl<'a, T, N: Unsigned> From<&'a T> for MarkedNonNull<T, N>
[src]
impl<'a, T, N: Unsigned> From<&'a mut T> for MarkedNonNull<T, N>
[src]
impl<T, N> Clone for MarkedNonNull<T, N>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T, N: Unsigned> Debug for MarkedNonNull<T, N>
[src]
impl<T, N: Unsigned> TryFrom<MarkedPtr<T, N>> for MarkedNonNull<T, N>
[src]
type Error = InvalidNullError
The type returned in the event of a conversion error.
fn try_from(ptr: MarkedPtr<T, N>) -> Result<Self, Self::Error>
[src]
impl<T, N: Unsigned> Pointer for MarkedNonNull<T, N>
[src]
Auto Trait Implementations
impl<T, N> !Send for MarkedNonNull<T, N>
impl<T, N> Unpin for MarkedNonNull<T, N> where
N: Unpin,
T: Unpin,
N: Unpin,
T: Unpin,
impl<T, N> !Sync for MarkedNonNull<T, N>
impl<T, N> UnwindSafe for MarkedNonNull<T, N> where
N: UnwindSafe,
T: RefUnwindSafe,
N: UnwindSafe,
T: RefUnwindSafe,
impl<T, N> RefUnwindSafe for MarkedNonNull<T, N> where
N: RefUnwindSafe,
T: RefUnwindSafe,
N: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
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> From<T> for 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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
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