quickjs_rusty::value

Struct JsModule

Source
pub struct JsModule { /* private fields */ }
Expand description

A bytecode compiled module.

Implementations§

Methods from Deref<Target = OwnedJsValue>§

Source

pub fn context(&self) -> *mut JSContext

Source

pub fn tag(&self) -> JsTag

Source

pub unsafe fn as_inner(&self) -> &JSValue

Get the inner JSValue without increasing ref count.

Unsafe because the caller must ensure proper memory management.

Source

pub fn is_null(&self) -> bool

Check if this value is null.

Source

pub fn is_undefined(&self) -> bool

Check if this value is undefined.

Source

pub fn is_bool(&self) -> bool

Check if this value is bool.

Source

pub fn is_int(&self) -> bool

Check if this value is int.

Source

pub fn is_float(&self) -> bool

Check if this value is float.

Source

pub fn is_exception(&self) -> bool

Check if this value is a Javascript exception.

Source

pub fn is_object(&self) -> bool

Check if this value is a Javascript object.

Source

pub fn is_array(&self) -> bool

Check if this value is a Javascript array.

Source

pub fn is_function(&self) -> bool

Check if this value is a Javascript function.

Source

pub fn is_promise(&self) -> bool

Check if this value is a Javascript promise.

Source

pub fn is_module(&self) -> bool

Check if this value is a Javascript module.

Source

pub fn is_string(&self) -> bool

Check if this value is a Javascript string.

Source

pub fn is_compiled_function(&self) -> bool

Check if this value is a bytecode compiled function.

Source

pub fn to_bool(&self) -> Result<bool, ValueError>

Convert this value into a bool

Source

pub fn to_int(&self) -> Result<i32, ValueError>

Convert this value into an i32

Source

pub fn to_float(&self) -> Result<f64, ValueError>

Convert this value into an f64

Source

pub fn to_string(&self) -> Result<String, ValueError>

Convert this value into a string

Source

pub fn to_array(&self) -> Result<OwnedJsArray, ValueError>

Source

pub fn to_date(&self) -> Result<DateTime<Utc>, ValueError>

Source

pub fn to_bigint(&self) -> Result<BigInt, ValueError>

Source

pub fn js_to_string(&self) -> Result<String, ExecutionError>

Call the Javascript .toString() method on this value.

Source

pub fn to_json_string(&self, space: u8) -> Result<String, ExecutionError>

Call the Javascript JSON.stringify() method on this value.

Trait Implementations§

Source§

impl Deref for JsModule

Source§

type Target = OwnedJsValue

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl TryFrom<OwnedJsValue> for JsModule

Source§

type Error = ValueError

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

fn try_from(value: OwnedJsValue) -> Result<Self, Self::Error>

Performs the conversion.

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.