Struct rquickjs::Ctx[][src]

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

Context in use, passed to Context::with.

Implementations

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

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

Evaluate a script in global context

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

Evaluate a script directly from a file.

pub fn compile<N, S>(
    self,
    name: N,
    source: S
) -> Result<Module<'js, Evaluated>, Error> where
    N: Into<Vec<u8, Global>>,
    S: Into<Vec<u8, Global>>, 
[src]

Compile a module for later use.

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

Returns the global object of this context.

pub fn promise(
    self
) -> Result<(Object<'js>, Function<'js>, Function<'js>), Error>
[src]

Creates promise and resolving functions.

pub fn spawn<F, T>(&self, future: F) where
    T: ParallelSend + 'static,
    F: Future<Output = T> + ParallelSend + 'static, 
[src]

This is supported on crate feature futures only.

Spawn future using configured async runtime

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

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

This is supported on crate feature registery only.

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]

This is supported on crate feature registery only.

Remove a value from the registery.

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

This is supported on crate feature registery only.

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>[src]

impl<'js> !Send for Ctx<'js>[src]

impl<'js> !Sync for Ctx<'js>[src]

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

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

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> ParallelSend for T where
    T: Send
[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.