🏷️ Introduce Weight type for element weights

This commit is contained in:
Manuel Cillero 2023-07-16 07:45:09 +02:00
parent 6df57a0c12
commit 941b7ae57b
28 changed files with 118 additions and 110 deletions

View file

@ -28,7 +28,7 @@ type AnchorHtml = OneComponent<L10n>;
#[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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -15,7 +15,7 @@ type ButtonValue = OneComponent<L10n>;
#[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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -19,7 +19,7 @@ type InputHelpText = OneComponent<L10n>;
#[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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -30,7 +30,7 @@ type HeadingText = OneComponent<L10n>;
#[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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}