diff --git a/drust/src/main.rs b/drust/src/main.rs index 2314c934..87973883 100644 --- a/drust/src/main.rs +++ b/drust/src/main.rs @@ -1,9 +1,8 @@ use pagetop::prelude::*; +#[derive(AssignHandle)] struct Drust; -impl_handle!(APP_DRUST for Drust); - impl ModuleTrait for Drust { fn dependencies(&self) -> Vec { vec![ diff --git a/examples/basics/hello-name/src/main.rs b/examples/basics/hello-name/src/main.rs index cf216f1f..e248d7ff 100644 --- a/examples/basics/hello-name/src/main.rs +++ b/examples/basics/hello-name/src/main.rs @@ -1,9 +1,8 @@ use pagetop::prelude::*; +#[derive(AssignHandle)] struct HelloName; -impl_handle!(APP_HELLO_NAME for HelloName); - impl ModuleTrait for HelloName { fn configure_service(&self, scfg: &mut service::web::ServiceConfig) { scfg.service(hello_name); diff --git a/examples/basics/hello-world/src/main.rs b/examples/basics/hello-world/src/main.rs index 516bade2..95b28647 100644 --- a/examples/basics/hello-world/src/main.rs +++ b/examples/basics/hello-world/src/main.rs @@ -1,9 +1,8 @@ use pagetop::prelude::*; +#[derive(AssignHandle)] struct HelloWorld; -impl_handle!(APP_HELLO_WORLD for HelloWorld); - impl ModuleTrait for HelloWorld { fn configure_service(&self, scfg: &mut service::web::ServiceConfig) { scfg.route("/", service::web::get().to(hello_world)); diff --git a/pagetop-admin/src/lib.rs b/pagetop-admin/src/lib.rs index db70f468..acf69fa6 100644 --- a/pagetop-admin/src/lib.rs +++ b/pagetop-admin/src/lib.rs @@ -4,10 +4,9 @@ static_locales!(LOCALES_ADMIN); mod summary; +#[derive(AssignHandle)] pub struct Admin; -impl_handle!(MODULE_ADMIN for Admin); - impl ModuleTrait for Admin { fn name(&self) -> L10n { L10n::t("module_name", &LOCALES_ADMIN) diff --git a/pagetop-bootsier/src/lib.rs b/pagetop-bootsier/src/lib.rs index 7a45a904..52c52e4b 100644 --- a/pagetop-bootsier/src/lib.rs +++ b/pagetop-bootsier/src/lib.rs @@ -4,10 +4,9 @@ static_locales!(LOCALES_BOOTSIER); static_files!(bootsier); +#[derive(AssignHandle)] pub struct Bootsier; -impl_handle!(THEME_BOOTSIER for Bootsier); - impl ModuleTrait for Bootsier { fn theme(&self) -> Option { Some(&Bootsier) @@ -83,7 +82,7 @@ impl ThemeTrait for Bootsier { fn before_prepare_component(&self, component: &mut dyn ComponentTrait, _cx: &mut Context) { match component.handle() { - COMPONENT_BASE_ICON => { + h if Icon::matches_handle(h) => { if let Some(i) = component_as_mut::(component) { match i.font_size() { FontSize::ExtraLarge => { @@ -105,7 +104,7 @@ impl ThemeTrait for Bootsier { }; } } - COMPONENT_BASE_BUTTON => { + h if Button::matches_handle(h) => { if let Some(b) = component_as_mut::