diff --git a/src/definition.rs b/src/definition.rs index 2c584f8..c900293 100644 --- a/src/definition.rs +++ b/src/definition.rs @@ -58,7 +58,7 @@ use rquickjs::{ /// } /// } /// ``` -pub trait ModuleDefExt { +pub trait Extension { type Implementation: ModuleImplementationType; fn globals(_globals: &Object<'_>, _options: &O) -> Result<()> { diff --git a/src/lib.rs b/src/lib.rs index 35bf9a3..c52fd51 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ //! [`ModuleDef`](rquickjs::module::ModuleDef) //! that would allow it to have options as input and set global. -pub use self::definition::{GlobalsOnly, ModuleDefExt, ModuleImpl}; +pub use self::definition::{Extension, GlobalsOnly, ModuleImpl}; pub use self::loader::{GlobalInitializer, ModuleLoader, ModuleLoaderBuilder, ModuleResolver}; mod definition; diff --git a/src/macros.rs b/src/macros.rs index 8706480..34d1348 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1,7 +1,7 @@ #[macro_export] macro_rules! globals_only_module { ($name:ident, |$globals:ident| { $($t:tt)* }) => { - impl ModuleDefExt for $name { + impl Extension for $name { type Implementation = GlobalsOnly; fn globals(globals: &Object<'_>, _options: &()) -> Result<()> { diff --git a/src/wrapper/globals.rs b/src/wrapper/globals.rs index 13a8b4d..62075d5 100644 --- a/src/wrapper/globals.rs +++ b/src/wrapper/globals.rs @@ -4,11 +4,11 @@ use rquickjs::{ }; use super::{IntoModule, ModuleMeta}; -use crate::{GlobalsOnly, ModuleDefExt}; +use crate::{GlobalsOnly, Extension}; pub struct GlobalDefWrapper where - T: ModuleDefExt, + T: Extension, for<'js> O: JsLifetime<'js>, { _marker: std::marker::PhantomData, @@ -17,14 +17,14 @@ where impl IntoModule> for T where - T: ModuleDefExt, + T: Extension, for<'js> O: JsLifetime<'js>, { } impl ModuleMeta for GlobalDefWrapper where - T: ModuleDefExt, + T: Extension, for<'js> O: JsLifetime<'js>, { fn name() -> &'static str { @@ -40,7 +40,7 @@ where impl ModuleDef for GlobalDefWrapper where - T: ModuleDefExt, + T: Extension, for<'js> O: JsLifetime<'js>, { //unused diff --git a/src/wrapper/mod.rs b/src/wrapper/mod.rs index 52bec10..2f6d2a3 100644 --- a/src/wrapper/mod.rs +++ b/src/wrapper/mod.rs @@ -1,6 +1,6 @@ use rquickjs::{module::ModuleDef, JsLifetime}; -use crate::ModuleDefExt; +use crate::Extension; mod globals; mod module; @@ -19,7 +19,7 @@ pub trait ModuleMeta { /// Semantically convert a [`ModuleDefExt`] to a [`ModuleDef`] and [`ModuleMeta`] pub trait IntoModule where - Self: ModuleDefExt, + Self: Extension, R: ModuleDef + ModuleMeta, for<'js> O: JsLifetime<'js>, { diff --git a/src/wrapper/module.rs b/src/wrapper/module.rs index fd6ee11..ef3170e 100644 --- a/src/wrapper/module.rs +++ b/src/wrapper/module.rs @@ -4,11 +4,11 @@ use rquickjs::{ }; use super::{IntoModule, ModuleMeta}; -use crate::{ModuleDefExt, ModuleImpl}; +use crate::{Extension, ModuleImpl}; pub struct ModuleDefWrapper where - T: ModuleDefExt>, + T: Extension>, for<'js> O: JsLifetime<'js>, { _marker: std::marker::PhantomData, @@ -17,14 +17,14 @@ where impl IntoModule> for T where - T: ModuleDefExt>, + T: Extension>, for<'js> O: JsLifetime<'js> + 'static, { } impl ModuleMeta for ModuleDefWrapper where - T: ModuleDefExt>, + T: Extension>, for<'c> O: JsLifetime<'c> + 'static, { fn name() -> &'static str { @@ -38,7 +38,7 @@ where impl ModuleDef for ModuleDefWrapper where - T: ModuleDefExt>, + T: Extension>, for<'js> O: JsLifetime<'js> + 'static, { fn declare(decl: &Declarations) -> Result<()> {