Skip to main content

JSValue

Struct JSValue 

Source
pub struct JSValue(/* private fields */);

Implementations§

Source§

impl JSValue

Source

pub fn raw_bits(&self) -> u64

Source

pub fn from_raw_bits(bits: u64) -> Self

Source

pub fn new_int(i: i64) -> Self

Source

pub fn new_float(f: f64) -> Self

Source

pub fn is_float(&self) -> bool

Source

pub fn new_string(atom: Atom) -> Self

Source

pub fn new_object(ptr: usize) -> Self

Source

pub fn new_function(ptr: usize) -> Self

Source

pub fn new_symbol(atom: Atom) -> Self

Source

pub fn new_symbol_with_id(atom: Atom, id: u32) -> Self

Source

pub fn get_symbol_id(&self) -> u32

Source

pub fn new_bigint(ptr: usize) -> Self

Source

pub const fn undefined() -> Self

Source

pub const fn null() -> Self

Source

pub const fn bool(b: bool) -> Self

Source

pub fn is_undefined(&self) -> bool

Source

pub fn is_null(&self) -> bool

Source

pub fn is_null_or_undefined(&self) -> bool

Source

pub fn is_bool(&self) -> bool

Source

pub fn is_int(&self) -> bool

Source

pub fn both_int(a: &JSValue, b: &JSValue) -> bool

Source

pub fn both_object(a: &JSValue, b: &JSValue) -> bool

Source

pub fn both_raw_float(a: &JSValue, b: &JSValue) -> bool

Source

pub fn new_float_raw(f: f64) -> Self

Source

pub fn is_string(&self) -> bool

Source

pub fn is_object(&self) -> bool

Source

pub fn is_function(&self) -> bool

Source

pub fn is_symbol(&self) -> bool

Source

pub fn is_bigint(&self) -> bool

Source

pub fn is_object_like(&self) -> bool

Source

pub const fn new_tdz() -> Self

Source

pub fn is_tdz(&self) -> bool

Source

pub fn get_int(&self) -> i64

Source

pub fn to_number(&self) -> f64

Source

pub fn get_float(&self) -> f64

Source

pub fn get_atom(&self) -> Atom

Source

pub fn get_ptr(&self) -> usize

Source

pub unsafe fn object_from_ptr(ptr: usize) -> &'static JSObject

Source

pub unsafe fn object_from_ptr_mut(ptr: usize) -> &'static mut JSObject

Source

pub unsafe fn function_from_ptr(ptr: usize) -> &'static JSFunction

Source

pub unsafe fn function_from_ptr_mut(ptr: usize) -> &'static mut JSFunction

Source

pub fn as_object(&self) -> &JSObject

Source

pub fn as_object_mut(&self) -> &mut JSObject

Source

pub fn as_function(&self) -> &JSFunction

Source

pub fn as_function_mut(&self) -> &mut JSFunction

Source

pub fn get_bool(&self) -> bool

Source

pub fn is_truthy(&self) -> bool

Source

pub fn strict_eq(&self, other: &JSValue) -> bool

Source

pub fn debug_raw(&self) -> u64

Source

pub fn get_data(&self) -> u64

Source

pub fn retain_atoms_in(&self, ctx: &mut JSContext)

Source

pub fn release_atoms_in(&self, ctx: &mut JSContext)

Source

pub fn release_atoms_in_table(&self, table: &mut AtomTable)

Source§

impl JSValue

Source

pub fn get_type(&self) -> JSValueType

Trait Implementations§

Source§

impl Clone for JSValue

Source§

fn clone(&self) -> JSValue

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JSValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for JSValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.