diff --git a/helpers/pagetop-build/src/lib.rs b/helpers/pagetop-build/src/lib.rs index b0a13f3..b18cf52 100644 --- a/helpers/pagetop-build/src/lib.rs +++ b/helpers/pagetop-build/src/lib.rs @@ -101,7 +101,7 @@ //! //! pub struct MyExtension; //! -//! impl ExtensionTrait for MyExtension { +//! impl Extension for MyExtension { //! // Servicio web que publica los recursos de `guides` en `/ruta/a/guides`. //! fn configure_service(&self, scfg: &mut service::web::ServiceConfig) { //! include_files_service!(scfg, guides => "/ruta/a/guides"); diff --git a/helpers/pagetop-macros/src/lib.rs b/helpers/pagetop-macros/src/lib.rs index 301f483..b9be0be 100644 --- a/helpers/pagetop-macros/src/lib.rs +++ b/helpers/pagetop-macros/src/lib.rs @@ -175,7 +175,7 @@ pub fn builder_fn(_: TokenStream, item: TokenStream) -> TokenStream { // Genera el método alter_...() con el código del método with_...(). let fn_alter_doc = format!( - "Igual que [`{0}()`](Self::{0}), pero sin usar el patrón *builder*.", + "Igual que [`Self::{0}()`](Self::{0}), pero sin usar el patrón *builder*.", fn_with_name_str, ); let fn_alter = quote! { diff --git a/src/app.rs b/src/app.rs index 6b11c0f..c3576fc 100644 --- a/src/app.rs +++ b/src/app.rs @@ -16,10 +16,10 @@ use std::sync::LazyLock; /// Punto de entrada de una aplicación `PageTop`. /// -/// No almacena datos, pero **encapsula** el ciclo completo de configuración y puesta en marcha. -/// Para instanciarla se puede usar [`new`](Application::new) o [`prepare`](Application::prepare). -/// Después sólo hay que llamar a [`run`](Application::run) (o a [`test`](Application::test) si se -/// está preparando un entorno de pruebas). +/// No almacena datos, **encapsula** el inicio completo de configuración y puesta en marcha. Para +/// instanciarla se puede usar [`new()`](Application::new) o [`prepare()`](Application::prepare). +/// Después sólo hay que llamar a [`run()`](Application::run) para ejecutar la aplicación (o a +/// [`test()`](Application::test) si se está preparando un entorno de pruebas). pub struct Application; impl Default for Application { diff --git a/src/base/action/component/after_render_component.rs b/src/base/action/component/after_render_component.rs index 48873f7..917f322 100644 --- a/src/base/action/component/after_render_component.rs +++ b/src/base/action/component/after_render_component.rs @@ -3,7 +3,7 @@ use crate::prelude::*; use crate::base::action::FnActionWithComponent; /// Ejecuta [`FnActionWithComponent`] después de renderizar un componente. -pub struct AfterRender { +pub struct AfterRender { f: FnActionWithComponent, referer_type_id: Option, referer_id: OptionId, @@ -11,7 +11,7 @@ pub struct AfterRender { } /// Filtro para despachar [`FnActionWithComponent`] después de renderizar un componente `C`. -impl ActionDispatcher for AfterRender { +impl ActionDispatcher for AfterRender { /// Devuelve el identificador de tipo ([`UniqueId`]) del componente `C`. fn referer_type_id(&self) -> Option { self.referer_type_id @@ -28,8 +28,8 @@ impl ActionDispatcher for AfterRender { } } -impl AfterRender { - /// Permite [registrar](ExtensionTrait::actions) una nueva acción [`FnActionWithComponent`]. +impl AfterRender { + /// Permite [registrar](Extension::actions) una nueva acción [`FnActionWithComponent`]. pub fn new(f: FnActionWithComponent) -> Self { AfterRender { f, diff --git a/src/base/action/component/before_render_component.rs b/src/base/action/component/before_render_component.rs index 483b916..8c2e38d 100644 --- a/src/base/action/component/before_render_component.rs +++ b/src/base/action/component/before_render_component.rs @@ -3,7 +3,7 @@ use crate::prelude::*; use crate::base::action::FnActionWithComponent; /// Ejecuta [`FnActionWithComponent`] antes de renderizar el componente. -pub struct BeforeRender { +pub struct BeforeRender { f: FnActionWithComponent, referer_type_id: Option, referer_id: OptionId, @@ -11,7 +11,7 @@ pub struct BeforeRender { } /// Filtro para despachar [`FnActionWithComponent`] antes de renderizar un componente `C`. -impl ActionDispatcher for BeforeRender { +impl ActionDispatcher for BeforeRender { /// Devuelve el identificador de tipo ([`UniqueId`]) del componente `C`. fn referer_type_id(&self) -> Option { self.referer_type_id @@ -28,8 +28,8 @@ impl ActionDispatcher for BeforeRender { } } -impl BeforeRender { - /// Permite [registrar](ExtensionTrait::actions) una nueva acción [`FnActionWithComponent`]. +impl BeforeRender { + /// Permite [registrar](Extension::actions) una nueva acción [`FnActionWithComponent`]. pub fn new(f: FnActionWithComponent) -> Self { BeforeRender { f, diff --git a/src/base/action/component/is_renderable.rs b/src/base/action/component/is_renderable.rs index 3f0f163..baa86f1 100644 --- a/src/base/action/component/is_renderable.rs +++ b/src/base/action/component/is_renderable.rs @@ -8,7 +8,7 @@ use crate::prelude::*; pub type FnIsRenderable = fn(component: &C, cx: &Context) -> bool; /// Con la función [`FnIsRenderable`] se puede decidir si se renderiza o no un componente. -pub struct IsRenderable { +pub struct IsRenderable { f: FnIsRenderable, referer_type_id: Option, referer_id: OptionId, @@ -16,7 +16,7 @@ pub struct IsRenderable { } /// Filtro para despachar [`FnIsRenderable`] para decidir si se renderiza o no un componente `C`. -impl ActionDispatcher for IsRenderable { +impl ActionDispatcher for IsRenderable { /// Devuelve el identificador de tipo ([`UniqueId`]) del componente `C`. fn referer_type_id(&self) -> Option { self.referer_type_id @@ -33,8 +33,8 @@ impl ActionDispatcher for IsRenderable { } } -impl IsRenderable { - /// Permite [registrar](ExtensionTrait::actions) una nueva acción [`FnIsRenderable`]. +impl IsRenderable { + /// Permite [registrar](Extension::actions) una nueva acción [`FnIsRenderable`]. pub fn new(f: FnIsRenderable) -> Self { IsRenderable { f, diff --git a/src/base/action/page/after_render_body.rs b/src/base/action/page/after_render_body.rs index 081b9aa..0bbfeab 100644 --- a/src/base/action/page/after_render_body.rs +++ b/src/base/action/page/after_render_body.rs @@ -22,7 +22,7 @@ impl ActionDispatcher for AfterRenderBody { } impl AfterRenderBody { - /// Permite [registrar](ExtensionTrait::actions) una nueva acción + /// Permite [registrar](Extension::actions) una nueva acción /// [`FnActionWithPage`](crate::base::action::page::FnActionWithPage). pub fn new(f: FnActionWithPage) -> Self { AfterRenderBody { f, weight: 0 } diff --git a/src/base/action/page/before_render_body.rs b/src/base/action/page/before_render_body.rs index a6e5c56..68f4af7 100644 --- a/src/base/action/page/before_render_body.rs +++ b/src/base/action/page/before_render_body.rs @@ -22,7 +22,7 @@ impl ActionDispatcher for BeforeRenderBody { } impl BeforeRenderBody { - /// Permite [registrar](ExtensionTrait::actions) una nueva acción + /// Permite [registrar](Extension::actions) una nueva acción /// [`FnActionWithPage`](crate::base::action::page::FnActionWithPage). pub fn new(f: FnActionWithPage) -> Self { BeforeRenderBody { f, weight: 0 } diff --git a/src/base/action/theme/after_render_component.rs b/src/base/action/theme/after_render_component.rs index d33e0d2..d0beeb4 100644 --- a/src/base/action/theme/after_render_component.rs +++ b/src/base/action/theme/after_render_component.rs @@ -3,7 +3,7 @@ use crate::prelude::*; use crate::base::action::FnActionWithComponent; /// Ejecuta [`FnActionWithComponent`] después de que un tema renderice el componente. -pub struct AfterRender { +pub struct AfterRender { f: FnActionWithComponent, theme_type_id: Option, referer_type_id: Option, @@ -11,7 +11,7 @@ pub struct AfterRender { /// Filtro para despachar [`FnActionWithComponent`] después de que un tema renderice el componente /// `C`. -impl ActionDispatcher for AfterRender { +impl ActionDispatcher for AfterRender { /// Devuelve el identificador de tipo ([`UniqueId`]) del tema. fn theme_type_id(&self) -> Option { self.theme_type_id @@ -23,9 +23,9 @@ impl ActionDispatcher for AfterRender { } } -impl AfterRender { - /// Permite [registrar](ExtensionTrait::actions) una nueva acción [`FnActionWithComponent`] para - /// un tema dado. +impl AfterRender { + /// Permite [registrar](Extension::actions) una nueva acción [`FnActionWithComponent`] para un + /// tema dado. pub fn new(theme: ThemeRef, f: FnActionWithComponent) -> Self { AfterRender { f, diff --git a/src/base/action/theme/before_render_component.rs b/src/base/action/theme/before_render_component.rs index 76f6cd2..ac5ee6b 100644 --- a/src/base/action/theme/before_render_component.rs +++ b/src/base/action/theme/before_render_component.rs @@ -3,7 +3,7 @@ use crate::prelude::*; use crate::base::action::FnActionWithComponent; /// Ejecuta [`FnActionWithComponent`] antes de que un tema renderice el componente. -pub struct BeforeRender { +pub struct BeforeRender { f: FnActionWithComponent, theme_type_id: Option, referer_type_id: Option, @@ -11,7 +11,7 @@ pub struct BeforeRender { /// Filtro para despachar [`FnActionWithComponent`] antes de que un tema renderice el componente /// `C`. -impl ActionDispatcher for BeforeRender { +impl ActionDispatcher for BeforeRender { /// Devuelve el identificador de tipo ([`UniqueId`]) del tema. fn theme_type_id(&self) -> Option { self.theme_type_id @@ -23,9 +23,9 @@ impl ActionDispatcher for BeforeRender { } } -impl BeforeRender { - /// Permite [registrar](ExtensionTrait::actions) una nueva acción [`FnActionWithComponent`] para - /// un tema dado. +impl BeforeRender { + /// Permite [registrar](Extension::actions) una nueva acción [`FnActionWithComponent`] para un + /// tema dado. pub fn new(theme: ThemeRef, f: FnActionWithComponent) -> Self { BeforeRender { f, diff --git a/src/base/action/theme/prepare_render.rs b/src/base/action/theme/prepare_render.rs index 9d3e261..4a1a2da 100644 --- a/src/base/action/theme/prepare_render.rs +++ b/src/base/action/theme/prepare_render.rs @@ -11,14 +11,14 @@ pub type FnPrepareRender = fn(component: &C, cx: &mut Context) -> PrepareMark /// Ejecuta [`FnPrepareRender`] para preparar el renderizado de un componente. /// /// Permite a un tema hacer una implementación nueva del renderizado de un componente. -pub struct PrepareRender { +pub struct PrepareRender { f: FnPrepareRender, theme_type_id: Option, referer_type_id: Option, } /// Filtro para despachar [`FnPrepareRender`] que modifica el renderizado de un componente `C`. -impl ActionDispatcher for PrepareRender { +impl ActionDispatcher for PrepareRender { /// Devuelve el identificador de tipo ([`UniqueId`]) del tema. fn theme_type_id(&self) -> Option { self.theme_type_id @@ -30,9 +30,9 @@ impl ActionDispatcher for PrepareRender { } } -impl PrepareRender { - /// Permite [registrar](ExtensionTrait::actions) una nueva acción [`FnPrepareRender`] para un - /// tema dado. +impl PrepareRender { + /// Permite [registrar](Extension::actions) una nueva acción [`FnPrepareRender`] para un tema + /// dado. pub fn new(theme: ThemeRef, f: FnPrepareRender) -> Self { PrepareRender { f, diff --git a/src/base/component/html.rs b/src/base/component/html.rs index 228bfe8..8f273ed 100644 --- a/src/base/component/html.rs +++ b/src/base/component/html.rs @@ -38,7 +38,7 @@ impl Default for Html { Html::with(|_| html! {}) } } -impl ComponentTrait for Html { +impl Component for Html { fn new() -> Self { Html::default() } @@ -51,9 +51,9 @@ impl ComponentTrait for Html { impl Html { /// Crea una instancia que generará el `Markup`, con acceso opcional al contexto. /// - /// El método [`prepare_component`](crate::core::component::ComponentTrait::prepare_component) - /// delega el renderizado en la función proporcionada, que recibe una referencia mutable - /// al contexto de renderizado ([`Context`]). + /// El método [`prepare_component()`](crate::core::component::Component::prepare_component) + /// delega el renderizado en la función proporcionada, que recibe una referencia mutable al + /// contexto de renderizado ([`Context`]). pub fn with(f: F) -> Self where F: Fn(&mut Context) -> Markup + Send + Sync + 'static, @@ -64,8 +64,8 @@ impl Html { /// Sustituye la función que genera el `Markup`. /// /// Permite a otras extensiones modificar la función de renderizado que se ejecutará cuando - /// [`prepare_component`](crate::core::component::ComponentTrait::prepare_component) invoque - /// esta instancia. La nueva función también recibe una referencia al contexto ([`Context`]). + /// [`prepare_component()`](crate::core::component::Component::prepare_component) invoque esta + /// instancia. La nueva función también recibe una referencia al contexto ([`Context`]). pub fn alter_html(&mut self, f: F) -> &mut Self where F: Fn(&mut Context) -> Markup + Send + Sync + 'static, diff --git a/src/base/extension/welcome.rs b/src/base/extension/welcome.rs index 39edfd3..3dda43e 100644 --- a/src/base/extension/welcome.rs +++ b/src/base/extension/welcome.rs @@ -7,7 +7,7 @@ use crate::prelude::*; /// funcionando correctamente. pub struct Welcome; -impl ExtensionTrait for Welcome { +impl Extension for Welcome { fn name(&self) -> L10n { L10n::l("welcome_extension_name") } diff --git a/src/base/theme/basic.rs b/src/base/theme/basic.rs index 4ea2460..b02abfb 100644 --- a/src/base/theme/basic.rs +++ b/src/base/theme/basic.rs @@ -5,13 +5,13 @@ use crate::prelude::*; /// Tema básico por defecto. pub struct Basic; -impl ExtensionTrait for Basic { +impl Extension for Basic { fn theme(&self) -> Option { Some(&Self) } } -impl ThemeTrait for Basic { +impl Theme for Basic { fn after_render_page_body(&self, page: &mut Page) { page.alter_assets(AssetsOp::AddStyleSheet( StyleSheet::from("/css/normalize.css") diff --git a/src/core/action.rs b/src/core/action.rs index f5dc11c..cbbe79c 100644 --- a/src/core/action.rs +++ b/src/core/action.rs @@ -14,8 +14,7 @@ mod all; pub(crate) use all::add_action; pub use all::dispatch_actions; -/// Facilita la implementación del método -/// [`actions()`](crate::core::extension::ExtensionTrait::actions). +/// Facilita la implementación del método [`actions()`](crate::core::extension::Extension::actions). /// /// Evita escribir repetidamente `Box::new(...)` para cada acción de la lista, manteniendo el código /// más limpio. @@ -25,7 +24,7 @@ pub use all::dispatch_actions; /// ```rust,ignore /// use pagetop::prelude::*; /// -/// impl ExtensionTrait for MyTheme { +/// impl Extension for MyTheme { /// fn actions(&self) -> Vec { /// actions_boxed![ /// action::theme::BeforeRender::