pub struct Value(/* private fields */);Expand description
A NaN-boxed JavaScript value. ABI-identical to a u64, so *mut Value
arrays and Completion fields carry it with no wrapping.
Implementations§
Source§impl Value
impl Value
Sourcepub const UNINITIALIZED: Value
pub const UNINITIALIZED: Value
The uninitialized register-slot sentinel written by the frame prologue.
Sourcepub const fn int32(value: u32) -> Value
pub const fn int32(value: u32) -> Value
Boxes a 32-bit integer (int32Payload, upper half zero).
Sourcepub fn number(value: f64) -> Value
pub fn number(value: f64) -> Value
Encodes a double. Every NaN is canonicalized to CANON_NAN, so the
result never collides with the boxed range (canonicalizeNaN).
Sourcepub const fn from_bits(bits: u64) -> Value
pub const fn from_bits(bits: u64) -> Value
Reinterprets a raw 64-bit ABI word as a Value. The wire word is taken
verbatim; use Value::decode to interpret it.
Sourcepub const fn is_uninitialized(self) -> bool
pub const fn is_uninitialized(self) -> bool
Whether the word is exactly the uninitialized sentinel. This is the hot check the frame prologue and GC scan rely on.
Sourcepub const fn decode(self) -> Option<Decoded>
pub const fn decode(self) -> Option<Decoded>
Interprets the word per the tag-specific payload rules (decode).
Returns None for a boxed word whose payload is malformed for its tag.
Sourcepub const fn as_int32(self) -> Option<u32>
pub const fn as_int32(self) -> Option<u32>
The integer, when the word is a well-formed boxed int32.
Sourcepub const fn as_bool(self) -> Option<bool>
pub const fn as_bool(self) -> Option<bool>
The boolean, when the word is a well-formed boxed boolean.
Sourcepub const fn as_heap_ref(self) -> Option<SlotId>
pub const fn as_heap_ref(self) -> Option<SlotId>
The heap slot, when the word is a well-formed boxed reference.