pub struct ThinArcOrInt<H, T> { /* private fields */ }Expand description
A type representing either a signed pointer-sized integer (isize) or
a reference-counted pointer (ThinArc<H, T>).
Optimized using NonNull so that Option<ThinArcOrInt<H, T>> takes up exactly
the size of a single architecture pointer.
Implementations§
Source§impl<H, T> ThinArcOrInt<H, T>
impl<H, T> ThinArcOrInt<H, T>
Sourcepub fn from_isize(val: IsizeInPtr) -> Self
pub fn from_isize(val: IsizeInPtr) -> Self
Constructs an instance from a signed integer that will be stored as a tagged value inside this pointer.
Sourcepub fn from_arc(arc: ThinArc<H, T>) -> Self
pub fn from_arc(arc: ThinArc<H, T>) -> Self
Constructs an instance from a ThinArc pointer. (Assumes the pointer is aligned and its LSB is 0.)
Sourcepub fn from_convertible<U, E>(value: U, slice: &[T]) -> Self
pub fn from_convertible<U, E>(value: U, slice: &[T]) -> Self
If slice is empty, tries to convert a value using try_into() to IsizeInPtr. If it
succeeds, stores it as a tagged integer inside this pointer. Otherwise constructs a
ThinArc to hold everything.
Sourcepub fn has_number(&self) -> bool
pub fn has_number(&self) -> bool
Returns true iff this instance holds a number as a tagged value inside this pointer, that
is, without any memory allocation.
Sourcepub fn has_ref(&self) -> bool
pub fn has_ref(&self) -> bool
Returns true iff this instance holds real pointer to a ThinArc<H, T> value.