Struct neon::context::ModuleContext [−][src]
A view of the JS engine in the context of top-level initialization of a Neon module.
Implementations
impl<'a> ModuleContext<'a>
[src]
pub fn export_function<T: Value>(
&mut self,
key: &str,
f: fn(_: FunctionContext<'_>) -> JsResult<'_, T>
) -> NeonResult<()>
[src]
&mut self,
key: &str,
f: fn(_: FunctionContext<'_>) -> JsResult<'_, T>
) -> NeonResult<()>
Convenience method for exporting a Neon function from a module.
pub fn export_class<T: Class>(&mut self, key: &str) -> NeonResult<()>
[src]
Convenience method for exporting a Neon class constructor from a module.
pub fn export_value<T: Value>(
&mut self,
key: &str,
val: Handle<'_, T>
) -> NeonResult<()>
[src]
&mut self,
key: &str,
val: Handle<'_, T>
) -> NeonResult<()>
Exports a JavaScript value from a Neon module.
pub fn exports_object(&mut self) -> JsResult<'a, JsObject>
[src]
Produces a handle to a module's exports object.
Trait Implementations
impl<'a> Context<'a> for ModuleContext<'a>
[src]
fn lock(&self) -> Lock<'_>
[src]
fn borrow<'c, V, T, F>(&self, v: &'c Handle<'_, V>, f: F) -> T where
V: Value,
&'c V: Borrow,
F: for<'b> FnOnce(Ref<'b, <&'c V as Borrow>::Target>) -> T,
[src]
V: Value,
&'c V: Borrow,
F: for<'b> FnOnce(Ref<'b, <&'c V as Borrow>::Target>) -> T,
fn borrow_mut<'c, V, T, F>(&self, v: &'c mut Handle<'_, V>, f: F) -> T where
V: Value,
&'c mut V: BorrowMut,
F: for<'b> FnOnce(RefMut<'b, <&'c mut V as Borrow>::Target>) -> T,
[src]
V: Value,
&'c mut V: BorrowMut,
F: for<'b> FnOnce(RefMut<'b, <&'c mut V as Borrow>::Target>) -> T,
fn execute_scoped<T, F>(&self, f: F) -> T where
F: for<'b> FnOnce(ExecuteContext<'b>) -> T,
[src]
F: for<'b> FnOnce(ExecuteContext<'b>) -> T,
fn compute_scoped<V, F>(&self, f: F) -> JsResult<'a, V> where
V: Value,
F: for<'b, 'c> FnOnce(ComputeContext<'b, 'c>) -> JsResult<'b, V>,
[src]
V: Value,
F: for<'b, 'c> FnOnce(ComputeContext<'b, 'c>) -> JsResult<'b, V>,
fn try_catch<'b: 'a, T, F>(&mut self, f: F) -> Result<T, Handle<'a, JsValue>> where
F: FnOnce(&mut Self) -> NeonResult<T>,
[src]
F: FnOnce(&mut Self) -> NeonResult<T>,
fn boolean(&mut self, b: bool) -> Handle<'a, JsBoolean>
[src]
fn number<T: Into<f64>>(&mut self, x: T) -> Handle<'a, JsNumber>
[src]
fn string<S: AsRef<str>>(&mut self, s: S) -> Handle<'a, JsString>
[src]
fn try_string<S: AsRef<str>>(&mut self, s: S) -> StringResult<'a>
[src]
fn null(&mut self) -> Handle<'a, JsNull>
[src]
fn undefined(&mut self) -> Handle<'a, JsUndefined>
[src]
fn empty_object(&mut self) -> Handle<'a, JsObject>
[src]
fn empty_array(&mut self) -> Handle<'a, JsArray>
[src]
fn array_buffer(&mut self, size: u32) -> JsResult<'a, JsArrayBuffer>
[src]
fn buffer(&mut self, size: u32) -> JsResult<'a, JsBuffer>
[src]
fn global(&mut self) -> Handle<'a, JsObject>
[src]
fn throw<'b, T: Value, U>(&mut self, v: Handle<'b, T>) -> NeonResult<U>
[src]
fn error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError>
[src]
fn type_error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError>
[src]
fn range_error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError>
[src]
fn throw_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T>
[src]
fn throw_type_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T>
[src]
fn throw_range_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T>
[src]
impl<'a> UnwindSafe for ModuleContext<'a>
[src]
Auto Trait Implementations
impl<'a> !RefUnwindSafe for ModuleContext<'a>
[src]
impl<'a> !Send for ModuleContext<'a>
[src]
impl<'a> !Sync for ModuleContext<'a>
[src]
impl<'a> Unpin for ModuleContext<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,