[][src]Struct rquickjs::Ctx

pub struct Ctx<'js> { /* fields omitted */ }

Context in use, passed to Context::with.

Methods

impl<'js> Ctx<'js>[src]

pub fn eval<V: FromJs<'js>, S: Into<Vec<u8>>>(self, source: S) -> Result<V>[src]

Evaluate a script in global context

pub fn eval_file<V: FromJs<'js>, P: AsRef<Path>>(self, path: P) -> Result<V>[src]

Evaluate a script directly from a file.

pub fn compile<Sa, Sb>(self, name: Sa, source: Sb) -> Result<Module<'js>> where
    Sa: Into<Vec<u8>>,
    Sb: Into<Vec<u8>>, 
[src]

Compile a module for later use.

pub fn coerce_string(self, v: Value<'js>) -> Result<String<'js>>[src]

Coerce a value to a string in the same way javascript would coerce values.

pub fn coerce_i32(self, v: Value<'js>) -> Result<i32>[src]

Coerce a value to a i32 in the same way javascript would coerce values.

pub fn coerce_i64(self, v: Value<'js>) -> Result<i64>[src]

pub fn coerce_u64(self, v: Value<'js>) -> Result<u64>[src]

pub fn coerce_f64(self, v: Value<'js>) -> Result<f64>[src]

pub fn coerce_bool(self, v: Value<'js>) -> Result<bool>[src]

pub fn globals(self) -> Object<'js>[src]

Returns the global object of this context.

pub fn register(self, v: Value<'js>) -> RegisteryKey[src]

Store a value in the registery so references to it can be kept outside the scope of context use.

A registered value can be retrieved from any context belonging to the same runtime.

pub fn deregister(self, k: RegisteryKey) -> Option<Value<'js>>[src]

Remove a value from the registery.

pub fn get_register(self, k: RegisteryKey) -> Option<Value<'js>>[src]

Get a value from the registery.

Trait Implementations

impl<'js> Clone for Ctx<'js>[src]

impl<'js> Copy for Ctx<'js>[src]

impl<'js> Debug for Ctx<'js>[src]

Auto Trait Implementations

impl<'js> !RefUnwindSafe for Ctx<'js>

impl<'js> !Send for Ctx<'js>

impl<'js> !Sync for Ctx<'js>

impl<'js> Unpin for Ctx<'js>

impl<'js> UnwindSafe for Ctx<'js>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.