pub enum Value {
Undefined,
Null,
Bool(bool),
Int(i32),
Float(f64),
BigInt(JsBigInt),
String(JsString),
Symbol(SymbolRef),
Object(ObjectRef),
}Expand description
A JavaScript value held by the embedder.
Variants§
Undefined
Null
Bool(bool)
Int(i32)
Float(f64)
BigInt(JsBigInt)
String(JsString)
Symbol(SymbolRef)
Object(ObjectRef)
Implementations§
Source§impl Value
impl Value
Sourcepub fn try_clone(&self) -> Result<Self, RuntimeError>
pub fn try_clone(&self) -> Result<Self, RuntimeError>
The same value; never fails (kept for the current API’s callers).
Sourcepub fn number(value: f64) -> Self
pub fn number(value: f64) -> Self
A number: an Int when value is an integer in i32 range other
than -0, else a Float.
pub fn as_object(&self) -> Option<&ObjectRef>
Sourcepub fn to_boolean(&self) -> bool
pub fn to_boolean(&self) -> bool
ToBoolean, which never runs JavaScript.
Sourcepub const fn type_of(&self) -> &'static str
pub const fn type_of(&self) -> &'static str
typeof, for primitives and ordinary objects (a callable object is
"object" here; Runtime::type_of asks the engine).
Sourcepub fn strict_equal(&self, other: &Self) -> bool
pub fn strict_equal(&self, other: &Self) -> bool
IsStrictlyEqual.
Sourcepub fn same_value(&self, other: &Self) -> bool
pub fn same_value(&self, other: &Self) -> bool
SameValue.
Sourcepub fn same_value_zero(&self, other: &Self) -> bool
pub fn same_value_zero(&self, other: &Self) -> bool
SameValueZero.
Trait Implementations§
Source§impl From<CallableRef> for Value
impl From<CallableRef> for Value
Source§fn from(value: CallableRef) -> Self
fn from(value: CallableRef) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl !UnwindSafe for Value
impl Freeze for Value
impl Unpin for Value
impl UnsafeUnpin 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