pub struct Value(/* private fields */);Expand description
A JavaScript value, or the internal hole marker Value::EMPTY.
Copy, no Drop, no ownership protocol. Heap kinds carry a 32-bit arena
index; holding one across an allocation requires rooting it (see the crate
README).
Implementations§
Source§impl Value
impl Value
pub const UNDEFINED: Value
pub const NULL: Value
pub const TRUE: Value
pub const FALSE: Value
Sourcepub const EMPTY: Value
pub const EMPTY: Value
The internal hole marker: array holes, uninitialized bindings, empty slots. Never a JavaScript value.
Sourcepub fn number(value: f64) -> Value
pub fn number(value: f64) -> Value
A double; no attempt is made to produce an Int32. A NaN keeps its
bits, as QuickJS’s unboxed doubles do (x86’s 0.0 / 0.0 is
0xFFF8_0000_0000_0000, which a Float64Array shows), unless they
fall in the boxed range: those become CANONICAL_NAN.
pub const fn int32(value: i32) -> Value
pub const fn bool(value: bool) -> Value
pub const fn object(id: ObjectId) -> Value
pub const fn string(id: StringId) -> Value
pub const fn symbol(id: SymbolId) -> Value
pub const fn bigint(id: BigIntId) -> Value
pub fn kind(self) -> Kind
pub const fn is_double(self) -> bool
pub const fn is_int32(self) -> bool
pub const fn is_empty(self) -> bool
pub const fn is_undefined(self) -> bool
pub const fn is_null(self) -> bool
pub const fn as_int32(self) -> Option<i32>
pub const fn as_bool(self) -> Option<bool>
pub const fn as_object(self) -> Option<ObjectId>
pub const fn as_string(self) -> Option<StringId>
pub const fn as_symbol(self) -> Option<SymbolId>
pub const fn as_bigint(self) -> Option<BigIntId>
Trait Implementations§
impl Copy for Value
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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