From 4ce59d65205df1156007649113ab4fb9efe1de37 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Wed, 19 Jul 2023 19:25:43 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20{Trait}Base=20for=20Act?= =?UTF-8?q?ion/Module=20Component-like?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagetop/src/core/action.rs | 2 +- pagetop/src/core/action/definition.rs | 6 +++--- pagetop/src/core/module.rs | 2 +- pagetop/src/core/module/definition.rs | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pagetop/src/core/action.rs b/pagetop/src/core/action.rs index 0885c80a..c257973a 100644 --- a/pagetop/src/core/action.rs +++ b/pagetop/src/core/action.rs @@ -1,5 +1,5 @@ mod definition; -pub use definition::{action_ref, ActionTrait, BaseAction}; +pub use definition::{action_ref, ActionBase, ActionTrait}; mod list; pub use list::Action; diff --git a/pagetop/src/core/action/definition.rs b/pagetop/src/core/action/definition.rs index b302c797..ad46f11b 100644 --- a/pagetop/src/core/action/definition.rs +++ b/pagetop/src/core/action/definition.rs @@ -2,11 +2,11 @@ use crate::{Handle, Weight}; use std::any::Any; -pub trait BaseAction: Any { +pub trait ActionBase: Any { fn as_ref_any(&self) -> &dyn Any; } -pub trait ActionTrait: BaseAction + Send + Sync { +pub trait ActionTrait: ActionBase + Send + Sync { fn new() -> Self where Self: Sized; @@ -18,7 +18,7 @@ pub trait ActionTrait: BaseAction + Send + Sync { } } -impl BaseAction for C { +impl ActionBase for C { fn as_ref_any(&self) -> &dyn Any { self } diff --git a/pagetop/src/core/module.rs b/pagetop/src/core/module.rs index 0ecfbc65..3bfd99c8 100644 --- a/pagetop/src/core/module.rs +++ b/pagetop/src/core/module.rs @@ -1,4 +1,4 @@ mod definition; -pub use definition::{BaseModule, ModuleStaticRef, ModuleTrait}; +pub use definition::{ModuleBase, ModuleStaticRef, ModuleTrait}; pub(crate) mod all; diff --git a/pagetop/src/core/module/definition.rs b/pagetop/src/core/module/definition.rs index bd62c9bd..ab405d80 100644 --- a/pagetop/src/core/module/definition.rs +++ b/pagetop/src/core/module/definition.rs @@ -8,12 +8,12 @@ use crate::db::MigrationItem; pub type ModuleStaticRef = &'static dyn ModuleTrait; -pub trait BaseModule { +pub trait ModuleBase { fn single_name(&self) -> &'static str; } /// Los módulos deben implementar este *trait*. -pub trait ModuleTrait: BaseModule + Send + Sync { +pub trait ModuleTrait: ModuleBase + Send + Sync { fn handle(&self) -> Handle; fn name(&self) -> L10n { @@ -52,7 +52,7 @@ pub trait ModuleTrait: BaseModule + Send + Sync { fn configure_service(&self, cfg: &mut service::web::ServiceConfig) {} } -impl BaseModule for M { +impl ModuleBase for M { fn single_name(&self) -> &'static str { util::single_type_name::() }