pub struct SharedNaNValue { /* private fields */ }Expand description
64-bit NaN-boxed value. Stores one of: f64, i32, u32, bool, nil,
or OffsetPtr<T>. Discriminated via the IEEE 754 NaN bit pattern.
Implementations§
Sourcepub fn from_f64(v: f64) -> Self
pub fn from_f64(v: f64) -> Self
Wrap an f64. NaN inputs are canonicalised to the positive
canonical qNaN so the resulting bits never look boxed.
pub const fn from_i32(v: i32) -> Self
pub const fn from_u32(v: u32) -> Self
pub const fn from_bool(v: bool) -> Self
Sourcepub fn from_offset_ptr<T>(p: OffsetPtr<T>) -> Self
pub fn from_offset_ptr<T>(p: OffsetPtr<T>) -> Self
Wrap an OffsetPtr by storing its 32-bit index. The T parameter is type-erased; callers reconstruct it on extraction.
Sourcepub const fn from_raw(raw: u64) -> Self
pub const fn from_raw(raw: u64) -> Self
Construct from raw bits. Useful for serialisation / cross-process passing.
pub fn type_tag(self) -> NaNValueType
pub fn is_f64(self) -> bool
pub fn is_nil(self) -> bool
pub fn is_i32(self) -> bool
pub fn is_u32(self) -> bool
pub fn is_bool(self) -> bool
pub fn is_offset_ptr(self) -> bool
pub fn as_f64(self) -> Option<f64>
pub fn as_i32(self) -> Option<i32>
pub fn as_u32(self) -> Option<u32>
pub fn as_bool(self) -> Option<bool>
pub fn as_offset_ptr<T>(self) -> Option<OffsetPtr<T>>
Trait Implementations§
Source§fn clone(&self) -> SharedNaNValue
fn clone(&self) -> SharedNaNValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§fn eq(&self, other: &SharedNaNValue) -> bool
fn eq(&self, other: &SharedNaNValue) -> bool
Tests for
self and other values to be equal, and is used by ==.Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more