✨ Handle por defecto para definiciones del core
This commit is contained in:
parent
1269b99b1e
commit
71c1305fca
3 changed files with 14 additions and 6 deletions
|
|
@ -5,7 +5,7 @@ use crate::{define_handle, Handle};
|
|||
|
||||
pub use std::any::Any as AnyComponent;
|
||||
|
||||
define_handle!(COMPONENT_UNDEFINED);
|
||||
define_handle!(COMPONENT_UNNAMED);
|
||||
|
||||
pub trait BaseComponent {
|
||||
fn render(&mut self, rcx: &mut RenderContext) -> Markup;
|
||||
|
|
@ -17,7 +17,7 @@ pub trait ComponentTrait: AnyComponent + BaseComponent + Send + Sync {
|
|||
Self: Sized;
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_UNDEFINED
|
||||
COMPONENT_UNNAMED
|
||||
}
|
||||
|
||||
fn name(&self) -> String {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
use crate::Handle;
|
||||
use crate::{define_handle, Handle};
|
||||
|
||||
pub use std::any::Any as AnyHookAction;
|
||||
|
||||
define_handle!(HOOK_UNNAMED);
|
||||
|
||||
pub trait HookActionTrait: AnyHookAction + Send + Sync {
|
||||
fn new() -> Self
|
||||
where
|
||||
Self: Sized;
|
||||
|
||||
fn handle(&self) -> Handle;
|
||||
fn handle(&self) -> Handle {
|
||||
HOOK_UNNAMED
|
||||
}
|
||||
|
||||
fn weight(&self) -> isize {
|
||||
0
|
||||
|
|
|
|||
|
|
@ -3,20 +3,24 @@ use super::ThemeStaticRef;
|
|||
use crate::core::component::L10n;
|
||||
use crate::core::hook::HookAction;
|
||||
use crate::util::single_type_name;
|
||||
use crate::{server, Handle};
|
||||
use crate::{define_handle, server, Handle};
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
use crate::db::MigrationItem;
|
||||
|
||||
pub type ModuleStaticRef = &'static dyn ModuleTrait;
|
||||
|
||||
define_handle!(APP_UNNAMED);
|
||||
|
||||
pub trait BaseModule {
|
||||
fn single_name(&self) -> &'static str;
|
||||
}
|
||||
|
||||
/// Los módulos deben implementar este *trait*.
|
||||
pub trait ModuleTrait: BaseModule + Send + Sync {
|
||||
fn handle(&self) -> Handle;
|
||||
fn handle(&self) -> Handle {
|
||||
APP_UNNAMED
|
||||
}
|
||||
|
||||
fn name(&self) -> L10n {
|
||||
L10n::text(self.single_name())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue