From 5f366d36176282aa5a3530c66d95fd2ef7428a74 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Fri, 27 Oct 2023 08:52:20 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Rename=20main=20macros?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagetop/src/base/theme/inception.rs | 4 ++-- pagetop/src/db.rs | 2 +- pagetop/src/lib.rs | 2 +- pagetop/src/locale.rs | 10 +++++----- pagetop/src/prelude.rs | 6 +++--- pagetop/src/service.rs | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pagetop/src/base/theme/inception.rs b/pagetop/src/base/theme/inception.rs index 7a02b2c0..3557a077 100644 --- a/pagetop/src/base/theme/inception.rs +++ b/pagetop/src/base/theme/inception.rs @@ -2,7 +2,7 @@ use crate::prelude::*; new_handle!(THEME_INCEPTION); -static_files!(base); +new_static_files!(base); pub struct Inception; @@ -20,7 +20,7 @@ impl ModuleTrait for Inception { } fn configure_service(&self, scfg: &mut service::web::ServiceConfig) { - static_files_service!(scfg, "/base", base); + service_for_static_files!(scfg, "/base", base); } } diff --git a/pagetop/src/db.rs b/pagetop/src/db.rs index d30e37d9..4560b716 100644 --- a/pagetop/src/db.rs +++ b/pagetop/src/db.rs @@ -150,7 +150,7 @@ pub use migration::prelude::*; pub type MigrationItem = Box; #[macro_export] -macro_rules! pub_migration { +macro_rules! new_migration { ( $migration:ident ) => { pub struct $migration; diff --git a/pagetop/src/lib.rs b/pagetop/src/lib.rs index f1121278..8dda95ed 100644 --- a/pagetop/src/lib.rs +++ b/pagetop/src/lib.rs @@ -122,7 +122,7 @@ pub type Handle = u64; pub type Weight = i8; pub type HashMapResources = std::collections::HashMap<&'static str, StaticResource>; -static_locales!(LOCALES_PAGETOP); +new_static_locales!(LOCALES_PAGETOP); // ************************************************************************************************* // PUBLIC API. diff --git a/pagetop/src/locale.rs b/pagetop/src/locale.rs index 9170a6f4..55e6197b 100644 --- a/pagetop/src/locale.rs +++ b/pagetop/src/locale.rs @@ -70,13 +70,13 @@ //! # Cómo aplicar la localización en tu código //! //! Una vez hayas creado tu directorio de recursos FTL usa la macro -//! [`static_locales!`](crate::static_locales) para integrarlos en tu módulo o aplicación. Si tus -//! recursos se encuentran en el directorio `"src/locale"` bastará con declarar: +//! [`new_static_locales!`](crate::new_static_locales) para integrarlos en tu módulo o aplicación. +//! si tus recursos se encuentran en el directorio `"src/locale"` bastará con declarar: //! //! ``` //! use pagetop::prelude::*; //! -//! static_locales!(LOCALES_SAMPLE); +//! new_static_locales!(LOCALES_SAMPLE); //! ``` //! //! Y si están en otro directorio, entonces puedes usar: @@ -84,7 +84,7 @@ //! ``` //! use pagetop::prelude::*; //! -//! static_locales!(LOCALES_SAMPLE in "path/to/locale"); +//! new_static_locales!(LOCALES_SAMPLE in "path/to/locale"); //! ``` use crate::html::{Markup, PreEscaped}; @@ -139,7 +139,7 @@ pub fn langid_for(language: impl Into) -> Result<&'static LanguageIdenti #[macro_export] /// Define un conjunto de elementos de localización y textos locales de traducción. -macro_rules! static_locales { +macro_rules! new_static_locales { ( $LOCALES:ident $(, $core_locales:literal)? ) => { $crate::locale::fluent_templates::static_loader! { static $LOCALES = { diff --git a/pagetop/src/prelude.rs b/pagetop/src/prelude.rs index 9d5a0ba0..440ccd3f 100644 --- a/pagetop/src/prelude.rs +++ b/pagetop/src/prelude.rs @@ -15,9 +15,9 @@ pub use crate::{kv, new_handle}; // crate::config pub use crate::default_settings; // crate::locale -pub use crate::static_locales; +pub use crate::new_static_locales; // crate::service -pub use crate::{static_files, static_files_service}; +pub use crate::{new_static_files, service_for_static_files}; // crate::core::actions pub use crate::actions; // crate::base::action::component @@ -36,7 +36,7 @@ pub use crate::locale::*; pub use crate::datetime::*; #[cfg(feature = "database")] -pub use crate::{db, db::*, migrations, pub_migration}; +pub use crate::{db, db::*, migrations, new_migration}; pub use crate::service; pub use crate::service::HttpMessage; diff --git a/pagetop/src/service.rs b/pagetop/src/service.rs index 9e2bf551..101fa8da 100644 --- a/pagetop/src/service.rs +++ b/pagetop/src/service.rs @@ -13,7 +13,7 @@ pub use actix_web_files::Files as ActixFiles; pub use actix_web_static_files::ResourceFiles; #[macro_export] -macro_rules! static_files { +macro_rules! new_static_files { ( $bundle:ident ) => { $crate::paste! { mod [] { @@ -34,7 +34,7 @@ macro_rules! static_files { } #[macro_export] -macro_rules! static_files_service { +macro_rules! service_for_static_files { ( $scfg:ident, $path:expr, $bundle:ident ) => {{ $crate::paste! { let static_files = &$crate::config::SETTINGS.dev.static_files;