Struct rquickjs_core::Context[][src]

pub struct Context { /* fields omitted */ }

A single execution context with its own global variables and stack.

Can share objects with other contexts of the same runtime.

Implementations

impl Context[src]

pub fn from_ctx<'js>(ctx: Ctx<'js>) -> Result<Self>[src]

pub fn base(runtime: &Runtime) -> Result<Self>[src]

Creates a base context with only the required functions registered. If additional functions are required use Context::custom, Context::builder or Context::full.

pub fn custom<I: Intrinsic>(runtime: &Runtime) -> Result<Self>[src]

Creates a context with only the required intrinsics registered. If additional functions are required use Context::custom, Context::builder or Context::full.

pub fn full(runtime: &Runtime) -> Result<Self>[src]

Creates a context with all standart available intrinsics registered. If precise controll is required of which functions are available use Context::custom or Context::builder.

pub fn builder() -> ContextBuilder<()>[src]

Create a context builder for creating a context with a specific set of intrinsics

pub fn enable_big_num_ext(&self, enable: bool)[src]

pub fn runtime(&self) -> &Runtime[src]

Returns the associated runtime

pub fn with<F, R>(&self, f: F) -> R where
    F: FnOnce(Ctx<'_>) -> R, 
[src]

A entry point for manipulating and using javascript objects and scripts. The api is structured this way to avoid repeated locking the runtime when ever any function is called. This way the runtime is locked once before executing the callback. Furthermore, this way it is impossible to use values from different runtimes in this context which would otherwise be undefined behaviour.

This is the only way to get a Ctx object.

Trait Implementations

impl Clone for Context[src]

impl Drop for Context[src]

Auto Trait Implementations

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.