1a3621b727
1. inline everything 2. change `check_status` and `type_of` to macro 3. provide #[module_exports] macro 4. remove debug and repr[transparent] for ffi struct
17 lines
404 B
Rust
17 lines
404 B
Rust
use crate::{Callback, Env, JsObject, Result};
|
|
|
|
pub struct Module {
|
|
pub env: Env,
|
|
pub exports: JsObject,
|
|
}
|
|
|
|
#[deprecated(since = "1.0.0", note = "[module_exports] macro instead")]
|
|
impl Module {
|
|
pub fn create_named_method(&mut self, name: &str, function: Callback) -> Result<()> {
|
|
self
|
|
.exports
|
|
.set_named_property(name, self.env.create_function(name, function)?)?;
|
|
|
|
Ok(())
|
|
}
|
|
}
|