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_with_options<V: FromJs<'js>, S: Into<Vec<u8>>>(
self,
source: S,
options: EvalOptions
) -> Result<V>
pub fn eval_with_options<V: FromJs<'js>, S: Into<Vec<u8>>>(
self,
source: S,
options: EvalOptions
) -> Result<V>
Evaluate a script with the given options.
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.
pub fn eval_file_with_options<V: FromJs<'js>, P: AsRef<Path>>(
self,
path: P,
options: EvalOptions
) -> Result<V>
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,
Available on crate feature futures
only.
pub fn spawn<F, T>(&self, future: F) where
F: Future<Output = T> + ParallelSend + 'static,
T: ParallelSend + 'static,
futures
only.Spawn future using configured async runtime
sourceimpl<'js> Ctx<'js>
impl<'js> Ctx<'js>
sourcepub fn register(self, v: Value<'js>) -> RegisteryKey
Available on crate feature registery
only.
pub fn register(self, v: Value<'js>) -> RegisteryKey
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>>
Available on crate feature registery
only.
pub fn deregister(self, k: RegisteryKey) -> Option<Value<'js>>
registery
only.Remove a value from the registery.
sourcepub fn get_register(self, k: RegisteryKey) -> Option<Value<'js>>
Available on crate feature registery
only.
pub fn get_register(self, k: RegisteryKey) -> Option<Value<'js>>
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