From 7c8f51ba86b41f65849fddbb4f4c7bab12b642e2 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Wed, 4 May 2022 18:21:36 +0200 Subject: [PATCH] =?UTF-8?q?Modifica=20tipos=20num=C3=A9ricos=20por=20isize?= =?UTF-8?q?/usize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagetop/src/api/action/definition.rs | 6 +++--- pagetop/src/api/component/action.rs | 6 +++--- pagetop/src/api/component/assets.rs | 16 ++++++++-------- pagetop/src/api/component/definition.rs | 6 +++--- pagetop/src/api/module/definition.rs | 4 ++-- pagetop/src/api/theme/definition.rs | 4 ++-- pagetop/src/base/component/block.rs | 8 ++++---- pagetop/src/base/component/chunck.rs | 8 ++++---- pagetop/src/base/component/container.rs | 8 ++++---- pagetop/src/base/component/form/button.rs | 8 ++++---- pagetop/src/base/component/form/date.rs | 8 ++++---- pagetop/src/base/component/form/form.rs | 8 ++++---- pagetop/src/base/component/form/hidden.rs | 8 ++++---- pagetop/src/base/component/form/input.rs | 8 ++++---- pagetop/src/base/component/grid/column.rs | 8 ++++---- pagetop/src/base/component/grid/row.rs | 8 ++++---- pagetop/src/base/component/image.rs | 8 ++++---- pagetop/src/base/component/menu.rs | 16 ++++++++-------- pagetop/src/response/page/action.rs | 6 +++--- pagetop/src/util.rs | 3 +-- 20 files changed, 77 insertions(+), 78 deletions(-) diff --git a/pagetop/src/api/action/definition.rs b/pagetop/src/api/action/definition.rs index 4a813ef9..e0bab945 100644 --- a/pagetop/src/api/action/definition.rs +++ b/pagetop/src/api/action/definition.rs @@ -7,13 +7,13 @@ pub trait BaseAction { fn single_name(&self) -> &'static str; - fn qualified_name(&self, last: u8) -> &'static str; + fn qualified_name(&self, last: usize) -> &'static str; } pub trait ActionTrait: AnyAction + BaseAction + Send + Sync { fn new() -> Self where Self: Sized; - fn weight(&self) -> i8 { + fn weight(&self) -> isize { 0 } @@ -29,7 +29,7 @@ impl BaseAction for C { util::partial_type_name(std::any::type_name::(), 1) } - fn qualified_name(&self, last: u8) -> &'static str { + fn qualified_name(&self, last: usize) -> &'static str { util::partial_type_name(std::any::type_name::(), last) } } diff --git a/pagetop/src/api/component/action.rs b/pagetop/src/api/component/action.rs index 2569be85..6479cc11 100644 --- a/pagetop/src/api/component/action.rs +++ b/pagetop/src/api/component/action.rs @@ -8,7 +8,7 @@ pub enum TypeAction { pub struct ComponentAction { action: TypeAction, - weight: i8, + weight: isize, } impl ActionTrait for ComponentAction { @@ -19,7 +19,7 @@ impl ActionTrait for ComponentAction { } } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -36,7 +36,7 @@ impl ComponentAction { } } - pub fn new_with_weight(action: TypeAction, weight: i8) -> Self { + pub fn new_with_weight(action: TypeAction, weight: isize) -> Self { ComponentAction { action, weight, diff --git a/pagetop/src/api/component/assets.rs b/pagetop/src/api/component/assets.rs index 16821ada..c7faf1bc 100644 --- a/pagetop/src/api/component/assets.rs +++ b/pagetop/src/api/component/assets.rs @@ -101,7 +101,7 @@ impl Favicon { pub struct StyleSheet { source: &'static str, - weight: i8, + weight: isize, } impl StyleSheet { pub fn source(s: &'static str) -> Self { @@ -111,12 +111,12 @@ impl StyleSheet { } } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.weight = weight; self } - pub fn weight(self) -> i8 { + pub fn weight(self) -> isize { self.weight } @@ -134,7 +134,7 @@ pub enum JSMode { Async, Defer, Normal } pub struct JavaScript { source: &'static str, - weight: i8, + weight: isize, mode : JSMode, } impl JavaScript { @@ -146,7 +146,7 @@ impl JavaScript { } } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.weight = weight; self } @@ -156,7 +156,7 @@ impl JavaScript { self } - pub fn weight(self) -> i8 { + pub fn weight(self) -> isize { self.weight } @@ -180,7 +180,7 @@ pub struct PageAssets { stylesheets: Vec, javascripts: Vec, with_jquery: bool, - id_counter : u32, + id_counter : usize, } impl PageAssets { @@ -239,7 +239,7 @@ impl PageAssets { JavaScript::source( "/theme/js/jquery.min.js?ver=3.6.0" ) - .with_weight(i8::MIN) + .with_weight(isize::MIN) .with_mode(JSMode::Normal) ); self.with_jquery = true; diff --git a/pagetop/src/api/component/definition.rs b/pagetop/src/api/component/definition.rs index d32f1b3f..f7c1df43 100644 --- a/pagetop/src/api/component/definition.rs +++ b/pagetop/src/api/component/definition.rs @@ -11,7 +11,7 @@ pub trait BaseComponent { fn single_name(&self) -> &'static str; - fn qualified_name(&self, last: u8) -> &'static str; + fn qualified_name(&self, last: usize) -> &'static str; } pub trait ComponentTrait: AnyComponent + BaseComponent + Send + Sync { @@ -30,7 +30,7 @@ pub trait ComponentTrait: AnyComponent + BaseComponent + Send + Sync { true } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { 0 } @@ -57,7 +57,7 @@ impl BaseComponent for C { util::partial_type_name(std::any::type_name::(), 1) } - fn qualified_name(&self, last: u8) -> &'static str { + fn qualified_name(&self, last: usize) -> &'static str { util::partial_type_name(std::any::type_name::(), last) } } diff --git a/pagetop/src/api/module/definition.rs b/pagetop/src/api/module/definition.rs index 288e99bb..837304f3 100644 --- a/pagetop/src/api/module/definition.rs +++ b/pagetop/src/api/module/definition.rs @@ -8,7 +8,7 @@ pub trait BaseModule { fn single_name(&self) -> &'static str; - fn qualified_name(&self, last: u8) -> &'static str; + fn qualified_name(&self, last: usize) -> &'static str; } /// Los módulos deben implementar este *trait*. @@ -45,7 +45,7 @@ impl BaseModule for M { util::partial_type_name(std::any::type_name::(), 1) } - fn qualified_name(&self, last: u8) -> &'static str { + fn qualified_name(&self, last: usize) -> &'static str { util::partial_type_name(std::any::type_name::(), last) } } diff --git a/pagetop/src/api/theme/definition.rs b/pagetop/src/api/theme/definition.rs index 11551680..08d913e6 100644 --- a/pagetop/src/api/theme/definition.rs +++ b/pagetop/src/api/theme/definition.rs @@ -11,7 +11,7 @@ pub trait BaseTheme { fn single_name(&self) -> &'static str; - fn qualified_name(&self, last: u8) -> &'static str; + fn qualified_name(&self, last: usize) -> &'static str; } /// Los temas deben implementar este "trait". @@ -147,7 +147,7 @@ impl BaseTheme for T { util::partial_type_name(std::any::type_name::(), 1) } - fn qualified_name(&self, last: u8) -> &'static str { + fn qualified_name(&self, last: usize) -> &'static str { util::partial_type_name(std::any::type_name::(), last) } } diff --git a/pagetop/src/base/component/block.rs b/pagetop/src/base/component/block.rs index 96dc06b6..b1407d60 100644 --- a/pagetop/src/base/component/block.rs +++ b/pagetop/src/base/component/block.rs @@ -4,7 +4,7 @@ pub const TYPENAME_BLOCK: &str = "pagetop::base::component::block::Block"; pub struct Block { renderable: fn() -> bool, - weight : i8, + weight : isize, components: PageContainer, title : OptAttr, id : OptIden, @@ -29,7 +29,7 @@ impl ComponentTrait for Block { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -77,7 +77,7 @@ impl Block { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -109,7 +109,7 @@ impl Block { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/chunck.rs b/pagetop/src/base/component/chunck.rs index 902b1eef..26666344 100644 --- a/pagetop/src/base/component/chunck.rs +++ b/pagetop/src/base/component/chunck.rs @@ -4,7 +4,7 @@ pub const TYPENAME_CHUNCK: &str = "pagetop::base::component::chunck::Chunck"; pub struct Chunck { renderable: fn() -> bool, - weight : i8, + weight : isize, html : Markup, template : String, } @@ -23,7 +23,7 @@ impl ComponentTrait for Chunck { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -52,7 +52,7 @@ impl Chunck { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -74,7 +74,7 @@ impl Chunck { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/container.rs b/pagetop/src/base/component/container.rs index 2bfbc3e0..dbc58ce6 100644 --- a/pagetop/src/base/component/container.rs +++ b/pagetop/src/base/component/container.rs @@ -6,7 +6,7 @@ pub enum ContainerType { Header, Footer, Main, Section, Wrapper } pub struct Container { renderable : fn() -> bool, - weight : i8, + weight : isize, components : PageContainer, container : ContainerType, id : OptIden, @@ -33,7 +33,7 @@ impl ComponentTrait for Container { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -127,7 +127,7 @@ impl Container { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -159,7 +159,7 @@ impl Container { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/form/button.rs b/pagetop/src/base/component/form/button.rs index 783adbc6..16720106 100644 --- a/pagetop/src/base/component/form/button.rs +++ b/pagetop/src/base/component/form/button.rs @@ -6,7 +6,7 @@ pub enum ButtonType {Button, Reset, Submit} pub struct Button { renderable : fn() -> bool, - weight : i8, + weight : isize, button_type: ButtonType, name : OptAttr, value : OptAttr, @@ -36,7 +36,7 @@ impl ComponentTrait for Button { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -105,7 +105,7 @@ impl Button { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -147,7 +147,7 @@ impl Button { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/form/date.rs b/pagetop/src/base/component/form/date.rs index 7ef3f82d..741ac450 100644 --- a/pagetop/src/base/component/form/date.rs +++ b/pagetop/src/base/component/form/date.rs @@ -4,7 +4,7 @@ pub const TYPENAME_DATE: &str = "pagetop::base::component::form::date::Date"; pub struct Date { renderable : fn() -> bool, - weight : i8, + weight : isize, name : OptAttr, value : OptAttr, label : OptAttr, @@ -44,7 +44,7 @@ impl ComponentTrait for Date { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -105,7 +105,7 @@ impl Date { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -177,7 +177,7 @@ impl Date { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/form/form.rs b/pagetop/src/base/component/form/form.rs index e6b10261..0ddb99eb 100644 --- a/pagetop/src/base/component/form/form.rs +++ b/pagetop/src/base/component/form/form.rs @@ -6,7 +6,7 @@ pub enum FormMethod {Get, Post} pub struct Form { renderable: fn() -> bool, - weight : i8, + weight : isize, elements : PageContainer, action : OptAttr, charset : OptAttr, @@ -35,7 +35,7 @@ impl ComponentTrait for Form { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -86,7 +86,7 @@ impl Form { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -128,7 +128,7 @@ impl Form { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/form/hidden.rs b/pagetop/src/base/component/form/hidden.rs index 3e9b41f3..4df5fd4f 100644 --- a/pagetop/src/base/component/form/hidden.rs +++ b/pagetop/src/base/component/form/hidden.rs @@ -3,7 +3,7 @@ use crate::prelude::*; pub const TYPENAME_HIDDEN: &str = "pagetop::base::component::form::hidden::Hidden"; pub struct Hidden { - weight: i8, + weight: isize, name : OptIden, value : OptAttr, } @@ -17,7 +17,7 @@ impl ComponentTrait for Hidden { } } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -47,7 +47,7 @@ impl Hidden { // Hidden BUILDER. - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -64,7 +64,7 @@ impl Hidden { // Hidden ALTER. - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/form/input.rs b/pagetop/src/base/component/form/input.rs index 7a45ce21..573ddebf 100644 --- a/pagetop/src/base/component/form/input.rs +++ b/pagetop/src/base/component/form/input.rs @@ -6,7 +6,7 @@ pub enum InputType {Email, Password, Search, Telephone, Textfield, Url} pub struct Input { renderable : fn() -> bool, - weight : i8, + weight : isize, input_type : InputType, name : OptIden, value : OptAttr, @@ -54,7 +54,7 @@ impl ComponentTrait for Input { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -171,7 +171,7 @@ impl Input { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -258,7 +258,7 @@ impl Input { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/grid/column.rs b/pagetop/src/base/component/grid/column.rs index b4121549..add535e3 100644 --- a/pagetop/src/base/component/grid/column.rs +++ b/pagetop/src/base/component/grid/column.rs @@ -4,7 +4,7 @@ pub const TYPENAME_COLUMN: &str = "pagetop::base::component::grid::column::Colum pub struct Column { renderable: fn() -> bool, - weight : i8, + weight : isize, components: PageContainer, id : OptIden, classes : Classes, @@ -27,7 +27,7 @@ impl ComponentTrait for Column { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -68,7 +68,7 @@ impl Column { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -95,7 +95,7 @@ impl Column { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/grid/row.rs b/pagetop/src/base/component/grid/row.rs index 8077fec6..d8a8858a 100644 --- a/pagetop/src/base/component/grid/row.rs +++ b/pagetop/src/base/component/grid/row.rs @@ -4,7 +4,7 @@ pub const TYPENAME_ROW: &str = "pagetop::base::component::grid::row::Row"; pub struct Row { renderable: fn() -> bool, - weight : i8, + weight : isize, columns : PageContainer, id : OptIden, classes : Classes, @@ -27,7 +27,7 @@ impl ComponentTrait for Row { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -68,7 +68,7 @@ impl Row { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -95,7 +95,7 @@ impl Row { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/image.rs b/pagetop/src/base/component/image.rs index b88ead07..ee92215a 100644 --- a/pagetop/src/base/component/image.rs +++ b/pagetop/src/base/component/image.rs @@ -4,7 +4,7 @@ pub const TYPENAME_IMAGE: &str = "pagetop::base::component::image::Image"; pub struct Image { renderable: fn() -> bool, - weight : i8, + weight : isize, source : OptAttr, id : OptIden, classes : Classes, @@ -27,7 +27,7 @@ impl ComponentTrait for Image { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -61,7 +61,7 @@ impl Image { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -93,7 +93,7 @@ impl Image { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/base/component/menu.rs b/pagetop/src/base/component/menu.rs index 845284f9..f0bd2a40 100644 --- a/pagetop/src/base/component/menu.rs +++ b/pagetop/src/base/component/menu.rs @@ -17,7 +17,7 @@ pub enum MenuItemType { pub struct MenuItem { renderable: fn() -> bool, - weight : i8, + weight : isize, item_type : MenuItemType, } @@ -34,7 +34,7 @@ impl ComponentTrait for MenuItem { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -143,7 +143,7 @@ impl MenuItem { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -155,7 +155,7 @@ impl MenuItem { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } @@ -171,7 +171,7 @@ impl MenuItem { pub struct Menu { renderable: fn() -> bool, - weight : i8, + weight : isize, items : PageContainer, id : OptIden, classes : Classes, @@ -194,7 +194,7 @@ impl ComponentTrait for Menu { (self.renderable)() } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -254,7 +254,7 @@ impl Menu { self } - pub fn with_weight(mut self, weight: i8) -> Self { + pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); self } @@ -281,7 +281,7 @@ impl Menu { self } - pub fn alter_weight(&mut self, weight: i8) -> &mut Self { + pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; self } diff --git a/pagetop/src/response/page/action.rs b/pagetop/src/response/page/action.rs index e3173d7f..e90f05be 100644 --- a/pagetop/src/response/page/action.rs +++ b/pagetop/src/response/page/action.rs @@ -10,7 +10,7 @@ pub enum TypeAction { pub struct PageAction { action: TypeAction, - weight: i8, + weight: isize, } impl ActionTrait for PageAction { @@ -21,7 +21,7 @@ impl ActionTrait for PageAction { } } - fn weight(&self) -> i8 { + fn weight(&self) -> isize { self.weight } @@ -38,7 +38,7 @@ impl PageAction { } } - pub fn new_with_weight(action: TypeAction, weight: i8) -> Self { + pub fn new_with_weight(action: TypeAction, weight: isize) -> Self { PageAction { action, weight, diff --git a/pagetop/src/util.rs b/pagetop/src/util.rs index 3190b641..ca4a96fc 100644 --- a/pagetop/src/util.rs +++ b/pagetop/src/util.rs @@ -47,12 +47,11 @@ macro_rules! theme_static_files { }}; } -pub(crate) fn partial_type_name(type_name: &'static str, last: u8) -> &'static str { +pub(crate) fn partial_type_name(type_name: &'static str, last: usize) -> &'static str { if last == 0 { return type_name; } let positions: Vec<_> = type_name.rmatch_indices("::").collect(); - let last: usize = last as usize; if positions.len() < last { return type_name; }