diff --git a/pagetop-jquery/src/lib.rs b/pagetop-jquery/src/lib.rs index 585a85a9..86e3c3d1 100644 --- a/pagetop-jquery/src/lib.rs +++ b/pagetop-jquery/src/lib.rs @@ -49,7 +49,7 @@ fn after_prepare_body(page: &mut Page) { page.context().alter(ContextOp::AddJavaScript( JavaScript::at("/jquery/jquery.min.js") .with_version("3.6.0") - .with_weight(isize::MIN) + .with_weight(-99) .with_mode(ModeJS::Normal), )); } diff --git a/pagetop-megamenu/src/component.rs b/pagetop-megamenu/src/component.rs index 9112593a..129b5f7f 100644 --- a/pagetop-megamenu/src/component.rs +++ b/pagetop-megamenu/src/component.rs @@ -23,7 +23,7 @@ pub enum MegaMenuItemType { #[rustfmt::skip] #[derive(Default)] pub struct MegaMenuItem { - weight : isize, + weight : Weight, renderable: Renderable, item_type : MegaMenuItemType, } @@ -37,7 +37,7 @@ impl ComponentTrait for MegaMenuItem { COMPONENT_MEGAMENUITEM } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -124,8 +124,8 @@ impl MegaMenuItem { // MegaMenuItem BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } @@ -151,7 +151,7 @@ actions_for_component!(MegaMenu); #[rustfmt::skip] #[derive(Default)] pub struct MegaMenu { - weight : isize, + weight : Weight, renderable: Renderable, id : IdentifierValue, classes : Classes, @@ -172,7 +172,7 @@ impl ComponentTrait for MegaMenu { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -220,8 +220,8 @@ impl MegaMenu { // MegaMenu BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/anchor.rs b/pagetop-minimal/src/component/anchor.rs index 0d041e21..b09b3e77 100644 --- a/pagetop-minimal/src/component/anchor.rs +++ b/pagetop-minimal/src/component/anchor.rs @@ -28,7 +28,7 @@ type AnchorHtml = OneComponent; #[rustfmt::skip] #[derive(Default)] pub struct Anchor { - weight : isize, + weight : Weight, renderable : Renderable, id : IdentifierValue, classes : Classes, @@ -54,7 +54,7 @@ impl ComponentTrait for Anchor { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -105,8 +105,8 @@ impl Anchor { // Anchor BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/block.rs b/pagetop-minimal/src/component/block.rs index 956f64bf..f0e9264e 100644 --- a/pagetop-minimal/src/component/block.rs +++ b/pagetop-minimal/src/component/block.rs @@ -7,7 +7,7 @@ actions_for_component!(Block); #[rustfmt::skip] #[derive(Default)] pub struct Block { - weight : isize, + weight : Weight, renderable: Renderable, id : IdentifierValue, classes : Classes, @@ -29,7 +29,7 @@ impl ComponentTrait for Block { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -70,8 +70,8 @@ impl Block { } #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/container.rs b/pagetop-minimal/src/component/container.rs index cdd98932..7bea787a 100644 --- a/pagetop-minimal/src/component/container.rs +++ b/pagetop-minimal/src/component/container.rs @@ -17,7 +17,7 @@ pub enum ContainerType { #[rustfmt::skip] #[derive(Default)] pub struct Container { - weight : isize, + weight : Weight, renderable : Renderable, id : IdentifierValue, classes : Classes, @@ -42,7 +42,7 @@ impl ComponentTrait for Container { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -125,8 +125,8 @@ impl Container { // Container BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/form_element/button.rs b/pagetop-minimal/src/component/form_element/button.rs index d2977c84..df0130fe 100644 --- a/pagetop-minimal/src/component/form_element/button.rs +++ b/pagetop-minimal/src/component/form_element/button.rs @@ -15,7 +15,7 @@ type ButtonValue = OneComponent; #[rustfmt::skip] #[derive(Default)] pub struct Button { - weight : isize, + weight : Weight, renderable : Renderable, classes : Classes, button_type: ButtonType, @@ -37,7 +37,7 @@ impl ComponentTrait for Button { COMPONENT_BUTTON } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -93,8 +93,8 @@ impl Button { // Button BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/form_element/date.rs b/pagetop-minimal/src/component/form_element/date.rs index 2b097088..81e928fb 100644 --- a/pagetop-minimal/src/component/form_element/date.rs +++ b/pagetop-minimal/src/component/form_element/date.rs @@ -5,7 +5,7 @@ create_handle!(COMPONENT_DATE); #[rustfmt::skip] #[derive(Default)] pub struct Date { - weight : isize, + weight : Weight, renderable : Renderable, classes : Classes, name : AttributeValue, @@ -32,7 +32,7 @@ impl ComponentTrait for Date { COMPONENT_DATE } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -78,8 +78,8 @@ impl Date { // Date BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/form_element/form.rs b/pagetop-minimal/src/component/form_element/form.rs index a4299fa1..151c1180 100644 --- a/pagetop-minimal/src/component/form_element/form.rs +++ b/pagetop-minimal/src/component/form_element/form.rs @@ -14,7 +14,7 @@ pub enum FormMethod { #[rustfmt::skip] #[derive(Default)] pub struct Form { - weight : isize, + weight : Weight, renderable: Renderable, id : IdentifierValue, classes : Classes, @@ -40,7 +40,7 @@ impl ComponentTrait for Form { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -79,8 +79,8 @@ impl Form { // Form BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/form_element/hidden.rs b/pagetop-minimal/src/component/form_element/hidden.rs index c982e77e..925f143c 100644 --- a/pagetop-minimal/src/component/form_element/hidden.rs +++ b/pagetop-minimal/src/component/form_element/hidden.rs @@ -5,7 +5,7 @@ create_handle!(COMPONENT_HIDDEN); #[rustfmt::skip] #[derive(Default)] pub struct Hidden { - weight: isize, + weight: Weight, name : NameValue, value : AttributeValue, } @@ -19,7 +19,7 @@ impl ComponentTrait for Hidden { COMPONENT_HIDDEN } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -39,8 +39,8 @@ impl Hidden { // Hidden BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/form_element/input.rs b/pagetop-minimal/src/component/form_element/input.rs index 057048f4..af6ab03b 100644 --- a/pagetop-minimal/src/component/form_element/input.rs +++ b/pagetop-minimal/src/component/form_element/input.rs @@ -19,7 +19,7 @@ type InputHelpText = OneComponent; #[rustfmt::skip] #[derive(Default)] pub struct Input { - weight : isize, + weight : Weight, renderable : Renderable, classes : Classes, input_type : InputType, @@ -52,7 +52,7 @@ impl ComponentTrait for Input { COMPONENT_INPUT } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -166,8 +166,8 @@ impl Input { // Input BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/grid/column.rs b/pagetop-minimal/src/component/grid/column.rs index b872ccfa..8dd38a25 100644 --- a/pagetop-minimal/src/component/grid/column.rs +++ b/pagetop-minimal/src/component/grid/column.rs @@ -39,7 +39,7 @@ pub enum ColumnSize { #[rustfmt::skip] #[derive(Default)] pub struct Column { - weight : isize, + weight : Weight, renderable: Renderable, id : IdentifierValue, classes : Classes, @@ -61,7 +61,7 @@ impl ComponentTrait for Column { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -90,8 +90,8 @@ impl Column { // Column BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/grid/row.rs b/pagetop-minimal/src/component/grid/row.rs index ce9def7a..179c52e6 100644 --- a/pagetop-minimal/src/component/grid/row.rs +++ b/pagetop-minimal/src/component/grid/row.rs @@ -9,7 +9,7 @@ actions_for_component!(Row); #[rustfmt::skip] #[derive(Default)] pub struct Row { - weight : isize, + weight : Weight, renderable: Renderable, id : IdentifierValue, classes : Classes, @@ -30,7 +30,7 @@ impl ComponentTrait for Row { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -59,8 +59,8 @@ impl Row { // Row BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/heading.rs b/pagetop-minimal/src/component/heading.rs index 4aeab75b..8e4de53f 100644 --- a/pagetop-minimal/src/component/heading.rs +++ b/pagetop-minimal/src/component/heading.rs @@ -30,7 +30,7 @@ type HeadingText = OneComponent; #[rustfmt::skip] #[derive(Default)] pub struct Heading { - weight : isize, + weight : Weight, renderable : Renderable, id : IdentifierValue, classes : Classes, @@ -53,7 +53,7 @@ impl ComponentTrait for Heading { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -115,8 +115,8 @@ impl Heading { // Heading BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/icon.rs b/pagetop-minimal/src/component/icon.rs index f6b162c0..2a77b600 100644 --- a/pagetop-minimal/src/component/icon.rs +++ b/pagetop-minimal/src/component/icon.rs @@ -5,7 +5,7 @@ create_handle!(COMPONENT_ICON); #[rustfmt::skip] #[derive(Default)] pub struct Icon { - weight : isize, + weight : Weight, renderable: Renderable, icon_name : String, classes : Classes, @@ -20,7 +20,7 @@ impl ComponentTrait for Icon { COMPONENT_ICON } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -47,8 +47,8 @@ impl Icon { // Icon BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/image.rs b/pagetop-minimal/src/component/image.rs index bd1287c5..72d7b351 100644 --- a/pagetop-minimal/src/component/image.rs +++ b/pagetop-minimal/src/component/image.rs @@ -5,7 +5,7 @@ create_handle!(COMPONENT_IMAGE); #[rustfmt::skip] #[derive(Default)] pub struct Image { - weight : isize, + weight : Weight, renderable: Renderable, id : IdentifierValue, classes : Classes, @@ -26,7 +26,7 @@ impl ComponentTrait for Image { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -52,8 +52,8 @@ impl Image { // Image BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop-minimal/src/component/paragraph.rs b/pagetop-minimal/src/component/paragraph.rs index 78f98687..0043689d 100644 --- a/pagetop-minimal/src/component/paragraph.rs +++ b/pagetop-minimal/src/component/paragraph.rs @@ -16,7 +16,7 @@ pub enum ParagraphDisplay { #[rustfmt::skip] #[derive(Default)] pub struct Paragraph { - weight : isize, + weight : Weight, renderable: Renderable, id : IdentifierValue, classes : Classes, @@ -38,7 +38,7 @@ impl ComponentTrait for Paragraph { self.id.get() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -66,8 +66,8 @@ impl Paragraph { // Paragraph BUILDER. #[fn_builder] - pub fn alter_weight(&mut self, weight: isize) -> &mut Self { - self.weight = weight; + pub fn alter_weight(&mut self, value: Weight) -> &mut Self { + self.weight = value; self } diff --git a/pagetop/src/core/action/definition.rs b/pagetop/src/core/action/definition.rs index 0611879c..b302c797 100644 --- a/pagetop/src/core/action/definition.rs +++ b/pagetop/src/core/action/definition.rs @@ -1,4 +1,4 @@ -use crate::Handle; +use crate::{Handle, Weight}; use std::any::Any; @@ -13,7 +13,7 @@ pub trait ActionTrait: BaseAction + Send + Sync { fn handle(&self) -> Handle; - fn weight(&self) -> isize { + fn weight(&self) -> Weight { 0 } } diff --git a/pagetop/src/core/component.rs b/pagetop/src/core/component.rs index 9e0ce62e..e479590f 100644 --- a/pagetop/src/core/component.rs +++ b/pagetop/src/core/component.rs @@ -32,7 +32,7 @@ macro_rules! actions_for_component { pub struct [] { action: Option<[]>, - weight: isize, + weight: Weight, } impl ActionTrait for [] { @@ -47,7 +47,7 @@ macro_rules! actions_for_component { [] } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } } @@ -60,8 +60,8 @@ macro_rules! actions_for_component { } #[allow(dead_code)] - pub fn with_weight(mut self, weight: isize) -> Self { - self.weight = weight; + pub fn with_weight(mut self, value: Weight) -> Self { + self.weight = value; self } @@ -91,7 +91,7 @@ macro_rules! actions_for_component { pub struct [] { action: Option<[]>, - weight: isize, + weight: Weight, } impl ActionTrait for [] { @@ -106,7 +106,7 @@ macro_rules! actions_for_component { [] } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } } @@ -119,8 +119,8 @@ macro_rules! actions_for_component { } #[allow(dead_code)] - pub fn with_weight(mut self, weight: isize) -> Self { - self.weight = weight; + pub fn with_weight(mut self, value: Weight) -> Self { + self.weight = value; self } diff --git a/pagetop/src/core/component/definition.rs b/pagetop/src/core/component/definition.rs index a431dc37..426ef76d 100644 --- a/pagetop/src/core/component/definition.rs +++ b/pagetop/src/core/component/definition.rs @@ -1,6 +1,6 @@ use crate::core::component::Context; use crate::html::{html, Markup, PrepareMarkup}; -use crate::{util, Handle}; +use crate::{util, Handle, Weight}; use std::any::Any; @@ -31,7 +31,7 @@ pub trait ComponentTrait: BaseComponent + Send + Sync { None } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { 0 } diff --git a/pagetop/src/core/theme/basic.rs b/pagetop/src/core/theme/basic.rs index 7c196eae..2a581bec 100644 --- a/pagetop/src/core/theme/basic.rs +++ b/pagetop/src/core/theme/basic.rs @@ -30,7 +30,9 @@ impl ThemeTrait for Basic { fn before_prepare_body(&self, page: &mut Page) { page.alter_favicon(Some(Favicon::new().with_icon("/theme/favicon.ico"))) .alter_context(ContextOp::AddStyleSheet( - StyleSheet::at("/theme/css/normalize.min.css").with_version("8.0.1"), + StyleSheet::at("/theme/css/normalize.min.css") + .with_version("8.0.1") + .with_weight(-99), )); } } diff --git a/pagetop/src/html/assets.rs b/pagetop/src/html/assets.rs index 2006dae7..92e91d9f 100644 --- a/pagetop/src/html/assets.rs +++ b/pagetop/src/html/assets.rs @@ -4,11 +4,12 @@ pub mod javascript; pub mod stylesheet; use crate::html::{html, Markup}; +use crate::Weight; pub trait AssetsTrait { fn path(&self) -> &str; - fn weight(&self) -> isize; + fn weight(&self) -> Weight; fn prepare(&self) -> Markup; } diff --git a/pagetop/src/html/assets/headscript.rs b/pagetop/src/html/assets/headscript.rs index ac384fbb..2cea8186 100644 --- a/pagetop/src/html/assets/headscript.rs +++ b/pagetop/src/html/assets/headscript.rs @@ -1,12 +1,13 @@ use crate::html::assets::AssetsTrait; use crate::html::{html, Markup}; +use crate::Weight; #[rustfmt::skip] #[derive(Default)] pub struct HeadScript { path : String, code : String, - weight: isize, + weight: Weight, } impl AssetsTrait for HeadScript { @@ -14,7 +15,7 @@ impl AssetsTrait for HeadScript { self.path.as_str() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -39,8 +40,8 @@ impl HeadScript { self } - pub fn with_weight(mut self, weight: isize) -> Self { - self.weight = weight; + pub fn with_weight(mut self, value: Weight) -> Self { + self.weight = value; self } } diff --git a/pagetop/src/html/assets/headstyles.rs b/pagetop/src/html/assets/headstyles.rs index 5996eb05..9608d666 100644 --- a/pagetop/src/html/assets/headstyles.rs +++ b/pagetop/src/html/assets/headstyles.rs @@ -1,12 +1,13 @@ use crate::html::assets::AssetsTrait; use crate::html::{html, Markup}; +use crate::Weight; #[rustfmt::skip] #[derive(Default)] pub struct HeadStyles { path : String, styles: String, - weight: isize, + weight: Weight, } impl AssetsTrait for HeadStyles { @@ -14,7 +15,7 @@ impl AssetsTrait for HeadStyles { self.path.as_str() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -39,8 +40,8 @@ impl HeadStyles { self } - pub fn with_weight(mut self, weight: isize) -> Self { - self.weight = weight; + pub fn with_weight(mut self, value: Weight) -> Self { + self.weight = value; self } } diff --git a/pagetop/src/html/assets/javascript.rs b/pagetop/src/html/assets/javascript.rs index f1242c47..e69a1ae1 100644 --- a/pagetop/src/html/assets/javascript.rs +++ b/pagetop/src/html/assets/javascript.rs @@ -1,5 +1,6 @@ use crate::html::assets::AssetsTrait; use crate::html::{html, Markup}; +use crate::Weight; #[derive(Default, Eq, PartialEq)] pub enum ModeJS { @@ -15,7 +16,7 @@ pub struct JavaScript { path : String, prefix : &'static str, version: &'static str, - weight : isize, + weight : Weight, mode : ModeJS, } @@ -24,7 +25,7 @@ impl AssetsTrait for JavaScript { self.path.as_str() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -59,8 +60,8 @@ impl JavaScript { self } - pub fn with_weight(mut self, weight: isize) -> Self { - self.weight = weight; + pub fn with_weight(mut self, value: Weight) -> Self { + self.weight = value; self } diff --git a/pagetop/src/html/assets/stylesheet.rs b/pagetop/src/html/assets/stylesheet.rs index 2acc0d5d..2cc53a1e 100644 --- a/pagetop/src/html/assets/stylesheet.rs +++ b/pagetop/src/html/assets/stylesheet.rs @@ -1,5 +1,6 @@ use crate::html::assets::AssetsTrait; use crate::html::{html, Markup}; +use crate::Weight; pub enum TargetMedia { Default, @@ -15,7 +16,7 @@ pub struct StyleSheet { prefix : &'static str, version: &'static str, media : Option<&'static str>, - weight : isize, + weight : Weight, } impl AssetsTrait for StyleSheet { @@ -23,7 +24,7 @@ impl AssetsTrait for StyleSheet { self.path.as_str() } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } @@ -57,8 +58,8 @@ impl StyleSheet { self } - pub fn with_weight(mut self, weight: isize) -> Self { - self.weight = weight; + pub fn with_weight(mut self, value: Weight) -> Self { + self.weight = value; self } diff --git a/pagetop/src/prelude.rs b/pagetop/src/prelude.rs index a3fd2241..a51eb062 100644 --- a/pagetop/src/prelude.rs +++ b/pagetop/src/prelude.rs @@ -1,9 +1,10 @@ //! The PageTop Prelude. -// Re-exports. -pub use crate::{ - concat_string, fn_builder, paste, Handle, HashMapResources, LazyStatic, ResultExt, -}; +// Re-exported macros. +pub use crate::{concat_string, fn_builder, paste}; + +// Global. +pub use crate::{Handle, HashMapResources, LazyStatic, ResultExt, Weight}; // Funciones y macros Ăștiles. pub use crate::util; @@ -11,7 +12,7 @@ pub use crate::{action, actions_for_component}; pub use crate::{create_handle, default_settings, kv}; pub use crate::{serve_static_files, static_files, static_locales}; -// ************************************************************************************************* +// API. pub use crate::config; diff --git a/pagetop/src/response/page/action/after_prepare_body.rs b/pagetop/src/response/page/action/after_prepare_body.rs index 941d6f52..719d7752 100644 --- a/pagetop/src/response/page/action/after_prepare_body.rs +++ b/pagetop/src/response/page/action/after_prepare_body.rs @@ -1,13 +1,13 @@ use crate::core::action::{action_ref, run_actions, ActionTrait}; use crate::response::page::action::ActionPage; use crate::response::page::Page; -use crate::{create_handle, Handle}; +use crate::{create_handle, Handle, Weight}; create_handle!(ACTION_AFTER_PREPARE_BODY for Action); pub struct ActionAfterPrepareBody { action: Option, - weight: isize, + weight: Weight, } impl ActionTrait for ActionAfterPrepareBody { @@ -22,7 +22,7 @@ impl ActionTrait for ActionAfterPrepareBody { ACTION_AFTER_PREPARE_BODY } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } } @@ -33,8 +33,8 @@ impl ActionAfterPrepareBody { self } - pub fn with_weight(mut self, weight: isize) -> Self { - self.weight = weight; + pub fn with_weight(mut self, value: Weight) -> Self { + self.weight = value; self } diff --git a/pagetop/src/response/page/action/before_prepare_body.rs b/pagetop/src/response/page/action/before_prepare_body.rs index 8971e51a..0c8d7907 100644 --- a/pagetop/src/response/page/action/before_prepare_body.rs +++ b/pagetop/src/response/page/action/before_prepare_body.rs @@ -1,13 +1,13 @@ use crate::core::action::{action_ref, run_actions, ActionTrait}; use crate::response::page::action::ActionPage; use crate::response::page::Page; -use crate::{create_handle, Handle}; +use crate::{create_handle, Handle, Weight}; create_handle!(ACTION_BEFORE_PREPARE_BODY for Action); pub struct ActionBeforePrepareBody { action: Option, - weight: isize, + weight: Weight, } impl ActionTrait for ActionBeforePrepareBody { @@ -22,7 +22,7 @@ impl ActionTrait for ActionBeforePrepareBody { ACTION_BEFORE_PREPARE_BODY } - fn weight(&self) -> isize { + fn weight(&self) -> Weight { self.weight } } @@ -33,8 +33,8 @@ impl ActionBeforePrepareBody { self } - pub fn with_weight(mut self, weight: isize) -> Self { - self.weight = weight; + pub fn with_weight(mut self, value: Weight) -> Self { + self.weight = value; self }