Struct rquickjs_core::Ctx
source · [−]pub struct Ctx<'js> { /* private fields */ }
Expand description
Context in use, passed to Context::with
.
Implementations
sourceimpl<'js> Ctx<'js>
impl<'js> Ctx<'js>
sourcepub fn eval<V: FromJs<'js>, S: Into<Vec<u8>>>(self, source: S) -> Result<V>
pub fn eval<V: FromJs<'js>, S: Into<Vec<u8>>>(self, source: S) -> Result<V>
Evaluate a script in global context
sourcepub fn eval_file<V: FromJs<'js>, P: AsRef<Path>>(self, path: P) -> Result<V>
pub fn eval_file<V: FromJs<'js>, P: AsRef<Path>>(self, path: P) -> Result<V>
Evaluate a script directly from a file.
sourcepub fn compile<N, S>(self, name: N, source: S) -> Result<Module<'js>> where
N: Into<Vec<u8>>,
S: Into<Vec<u8>>,
pub fn compile<N, S>(self, name: N, source: S) -> Result<Module<'js>> where
N: Into<Vec<u8>>,
S: Into<Vec<u8>>,
Compile a module for later use.
sourcepub fn promise(self) -> Result<(Object<'js>, Function<'js>, Function<'js>)>
pub fn promise(self) -> Result<(Object<'js>, Function<'js>, Function<'js>)>
Creates promise and resolving functions.
sourcepub fn spawn<F, T>(&self, future: F) where
F: Future<Output = T> + ParallelSend + 'static,
T: ParallelSend + 'static,
This is supported on crate feature futures
only.
pub fn spawn<F, T>(&self, future: F) where
F: Future<Output = T> + ParallelSend + 'static,
T: ParallelSend + 'static,
This is supported on crate feature
futures
only.Spawn future using configured async runtime
sourceimpl<'js> Ctx<'js>
impl<'js> Ctx<'js>
sourcepub fn register(self, v: Value<'js>) -> RegisteryKey
This is supported on crate feature registery
only.
pub fn register(self, v: Value<'js>) -> RegisteryKey
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.
sourcepub fn deregister(self, k: RegisteryKey) -> Option<Value<'js>>
This is supported on crate feature registery
only.
pub fn deregister(self, k: RegisteryKey) -> Option<Value<'js>>
This is supported on crate feature
registery
only.Remove a value from the registery.
sourcepub fn get_register(self, k: RegisteryKey) -> Option<Value<'js>>
This is supported on crate feature registery
only.
pub fn get_register(self, k: RegisteryKey) -> Option<Value<'js>>
This is supported on crate feature
registery
only.Get a value from the registery.
Trait Implementations
impl<'js> Copy for Ctx<'js>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more