🏷️ #[fn_with] pasa a ser #[fn_builder]
This commit is contained in:
parent
efc59216b4
commit
09195c7466
19 changed files with 133 additions and 133 deletions
|
|
@ -4,7 +4,7 @@ use quote::{quote, quote_spanned, ToTokens};
|
|||
use syn::{parse_macro_input, parse_str, ItemFn};
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn fn_with(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
pub fn fn_builder(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let fn_item = parse_macro_input!(item as ItemFn);
|
||||
let fn_name = fn_item.sig.ident.to_string();
|
||||
|
||||
|
|
@ -30,18 +30,18 @@ pub fn fn_with(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||
.collect();
|
||||
|
||||
#[rustfmt::skip]
|
||||
let fn_builder = parse_str::<ItemFn>(concat_string!("
|
||||
let fn_with = parse_str::<ItemFn>(concat_string!("
|
||||
pub fn ", fn_name.replace("alter_", "with_"), "(mut self, ", args.join(", "), ") -> Self {
|
||||
self.", fn_name, "(", param.join(", "), ");
|
||||
self
|
||||
}
|
||||
").as_str()).unwrap();
|
||||
|
||||
let fn_original = fn_item.into_token_stream();
|
||||
let fn_alter = fn_item.into_token_stream();
|
||||
|
||||
let expanded = quote! {
|
||||
#fn_builder
|
||||
#fn_original
|
||||
#fn_with
|
||||
#fn_alter
|
||||
};
|
||||
expanded.into()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,31 +105,31 @@ impl Anchor {
|
|||
|
||||
// Anchor BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_type(&mut self, anchor_type: AnchorType) -> &mut Self {
|
||||
self.anchor_type = anchor_type;
|
||||
self.classes.alter_value(
|
||||
|
|
@ -142,39 +142,39 @@ impl Anchor {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_href(&mut self, href: &str) -> &mut Self {
|
||||
self.href.alter_value(href);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_html(&mut self, html: Markup) -> &mut Self {
|
||||
self.html.markup = html;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_left_icon(&mut self, icon: Icon) -> &mut Self {
|
||||
self.left_icon.clear();
|
||||
self.left_icon.add(icon);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_right_icon(&mut self, icon: Icon) -> &mut Self {
|
||||
self.right_icon.clear();
|
||||
self.right_icon.add(icon);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_target(&mut self, target: AnchorTarget) -> &mut Self {
|
||||
self.target = target;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -63,43 +63,43 @@ impl ComponentTrait for Block {
|
|||
impl Block {
|
||||
// Block BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_title(&mut self, title: &str) -> &mut Self {
|
||||
self.title.alter_value(title);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_component(&mut self, component: impl ComponentTrait) -> &mut Self {
|
||||
self.components.add(component);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -124,43 +124,43 @@ impl Container {
|
|||
|
||||
// Container BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_inner_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.inner_classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_component(&mut self, component: impl ComponentTrait) -> &mut Self {
|
||||
self.components.add(component);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -97,37 +97,37 @@ impl Button {
|
|||
|
||||
// Button BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
||||
self.name.alter_value(name);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_value(&mut self, value: &str) -> &mut Self {
|
||||
self.value.alter_value(value);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_autofocus(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autofocus.alter_value(match toggle {
|
||||
true => "autofocus",
|
||||
|
|
@ -136,7 +136,7 @@ impl Button {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_disabled(&mut self, toggle: bool) -> &mut Self {
|
||||
self.disabled.alter_value(match toggle {
|
||||
true => "disabled",
|
||||
|
|
@ -145,7 +145,7 @@ impl Button {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -85,49 +85,49 @@ impl ComponentTrait for Date {
|
|||
impl Date {
|
||||
// Date BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
||||
self.name.alter_value(name);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_value(&mut self, value: &str) -> &mut Self {
|
||||
self.value.alter_value(value);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_label(&mut self, label: &str) -> &mut Self {
|
||||
self.label.alter_value(label);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_placeholder(&mut self, placeholder: &str) -> &mut Self {
|
||||
self.placeholder.alter_value(placeholder);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_autofocus(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autofocus.alter_value(match toggle {
|
||||
true => "autofocus",
|
||||
|
|
@ -136,7 +136,7 @@ impl Date {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_autocomplete(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autocomplete.alter_value(match toggle {
|
||||
true => "",
|
||||
|
|
@ -145,7 +145,7 @@ impl Date {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_disabled(&mut self, toggle: bool) -> &mut Self {
|
||||
self.disabled.alter_value(match toggle {
|
||||
true => "disabled",
|
||||
|
|
@ -154,7 +154,7 @@ impl Date {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_readonly(&mut self, toggle: bool) -> &mut Self {
|
||||
self.readonly.alter_value(match toggle {
|
||||
true => "readonly",
|
||||
|
|
@ -163,7 +163,7 @@ impl Date {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_required(&mut self, toggle: bool) -> &mut Self {
|
||||
self.required.alter_value(match toggle {
|
||||
true => "required",
|
||||
|
|
@ -172,13 +172,13 @@ impl Date {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_help_text(&mut self, help_text: &str) -> &mut Self {
|
||||
self.help_text.alter_value(help_text);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -78,55 +78,55 @@ impl ComponentTrait for Form {
|
|||
impl Form {
|
||||
// Form BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_action(&mut self, action: &str) -> &mut Self {
|
||||
self.action.alter_value(action);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_charset(&mut self, charset: &str) -> &mut Self {
|
||||
self.charset.alter_value(charset);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_method(&mut self, method: FormMethod) -> &mut Self {
|
||||
self.method = method;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_element(&mut self, element: impl ComponentTrait) -> &mut Self {
|
||||
self.elements.add(element);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -46,19 +46,19 @@ impl Hidden {
|
|||
|
||||
// Hidden BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
||||
self.name.alter_value(name);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_value(&mut self, value: &str) -> &mut Self {
|
||||
self.value.alter_value(value);
|
||||
self
|
||||
|
|
|
|||
|
|
@ -168,25 +168,25 @@ impl Input {
|
|||
|
||||
// Input BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
||||
self.name.alter_value(name);
|
||||
self.alter_classes(
|
||||
|
|
@ -196,43 +196,43 @@ impl Input {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_value(&mut self, value: &str) -> &mut Self {
|
||||
self.value.alter_value(value);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_label(&mut self, label: &str) -> &mut Self {
|
||||
self.label.alter_value(label);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_size(&mut self, size: Option<u16>) -> &mut Self {
|
||||
self.size = size;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_minlength(&mut self, minlength: Option<u16>) -> &mut Self {
|
||||
self.minlength = minlength;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_maxlength(&mut self, maxlength: Option<u16>) -> &mut Self {
|
||||
self.maxlength = maxlength;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_placeholder(&mut self, placeholder: &str) -> &mut Self {
|
||||
self.placeholder.alter_value(placeholder);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_autofocus(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autofocus.alter_value(match toggle {
|
||||
true => "autofocus",
|
||||
|
|
@ -241,7 +241,7 @@ impl Input {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_autocomplete(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autocomplete.alter_value(match toggle {
|
||||
true => "",
|
||||
|
|
@ -250,7 +250,7 @@ impl Input {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_disabled(&mut self, toggle: bool) -> &mut Self {
|
||||
self.disabled.alter_value(match toggle {
|
||||
true => "disabled",
|
||||
|
|
@ -259,7 +259,7 @@ impl Input {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_readonly(&mut self, toggle: bool) -> &mut Self {
|
||||
self.readonly.alter_value(match toggle {
|
||||
true => "readonly",
|
||||
|
|
@ -268,7 +268,7 @@ impl Input {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_required(&mut self, toggle: bool) -> &mut Self {
|
||||
self.required.alter_value(match toggle {
|
||||
true => "required",
|
||||
|
|
@ -277,13 +277,13 @@ impl Input {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_help_text(&mut self, help_text: &str) -> &mut Self {
|
||||
self.help_text.alter_value(help_text);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -89,32 +89,32 @@ impl ComponentTrait for Column {
|
|||
impl Column {
|
||||
// Column BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_size(&mut self, size: ColumnSize) -> &mut Self {
|
||||
match size {
|
||||
ColumnSize::Default => self.alter_classes(ClassesOp::SetDefault, SIZE__DEFAULT),
|
||||
|
|
@ -135,13 +135,13 @@ impl Column {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_component(&mut self, component: impl ComponentTrait) -> &mut Self {
|
||||
self.components.add(component);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -56,37 +56,37 @@ impl ComponentTrait for Row {
|
|||
impl Row {
|
||||
// Row BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_column(&mut self, column: grid::Column) -> &mut Self {
|
||||
self.columns.add(column);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -116,44 +116,44 @@ impl Heading {
|
|||
|
||||
// Heading BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_heading_type(&mut self, heading_type: HeadingType) -> &mut Self {
|
||||
self.heading_type = heading_type;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_html(&mut self, html: Markup) -> &mut Self {
|
||||
self.html.markup = html;
|
||||
self
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_display(&mut self, display: HeadingDisplay) -> &mut Self {
|
||||
self.display = display;
|
||||
self.classes.alter_value(
|
||||
|
|
@ -171,7 +171,7 @@ impl Heading {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -48,25 +48,25 @@ impl Html {
|
|||
|
||||
// Html BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_html(&mut self, html: Markup) -> &mut Self {
|
||||
self.html.markup = html;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -54,19 +54,19 @@ impl Icon {
|
|||
|
||||
// Icon BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_icon_name(&mut self, name: &str) -> &mut Self {
|
||||
self.icon_name = name.to_owned();
|
||||
self.alter_classes(
|
||||
|
|
@ -76,7 +76,7 @@ impl Icon {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
|
|
|
|||
|
|
@ -55,37 +55,37 @@ impl Image {
|
|||
|
||||
// Image BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_source(&mut self, source: &str) -> &mut Self {
|
||||
self.source.alter_value(source);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -127,13 +127,13 @@ impl MenuItem {
|
|||
|
||||
// MenuItem BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
|
|
@ -223,37 +223,37 @@ impl ComponentTrait for Menu {
|
|||
impl Menu {
|
||||
// Menu BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_item(&mut self, item: MenuItem) -> &mut Self {
|
||||
self.items.add(item);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -69,38 +69,38 @@ impl Paragraph {
|
|||
|
||||
// Paragraph BUILDER.
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_component(&mut self, component: impl ComponentTrait) -> &mut Self {
|
||||
self.components.add(component);
|
||||
self
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_display(&mut self, display: ParagraphDisplay) -> &mut Self {
|
||||
self.display = display;
|
||||
self.classes.alter_value(
|
||||
|
|
@ -117,7 +117,7 @@ impl Paragraph {
|
|||
self
|
||||
}
|
||||
|
||||
#[fn_with]
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ pub use doc_comment::doc_comment;
|
|||
pub use once_cell::sync::Lazy as LazyStatic;
|
||||
pub use tracing_unwrap::ResultExt;
|
||||
|
||||
pub use pagetop_macros::fn_with;
|
||||
pub use pagetop_macros::fn_builder;
|
||||
|
||||
// LOCAL.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Re-exports.
|
||||
pub use crate::{concat_string, fn_with, LazyStatic, ResultExt};
|
||||
pub use crate::{concat_string, fn_builder, LazyStatic, ResultExt};
|
||||
|
||||
// Macros.
|
||||
pub use crate::{args, pub_config, pub_handle, pub_locale, serve_static_files};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue