🚚 Restore macro name #[fn_builder] for fn_with

This commit is contained in:
Manuel Cillero 2024-02-28 09:08:50 +01:00
parent 2389aad546
commit a9a5d232a2
36 changed files with 190 additions and 187 deletions

View file

@ -9,7 +9,7 @@
//! **OptionClasses** assumes that the order of the classes is irrelevant
//! (<https://stackoverflow.com/a/1321712>), and duplicate classes will not be allowed.
use crate::{fn_with, AutoDefault};
use crate::{fn_builder, AutoDefault};
pub enum ClassesOp {
Add,
@ -30,7 +30,7 @@ impl OptionClasses {
// OptionClasses BUILDER.
#[fn_with]
#[fn_builder]
pub fn alter_value(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
let classes: String = classes.into();
let classes: Vec<&str> = classes.split_ascii_whitespace().collect();

View file

@ -1,5 +1,5 @@
use crate::core::component::{ArcTypedComponent, ComponentTrait, Context};
use crate::fn_with;
use crate::fn_builder;
use crate::html::{html, Markup};
pub struct OptionComponent<C: ComponentTrait>(Option<ArcTypedComponent<C>>);
@ -17,7 +17,7 @@ impl<C: ComponentTrait> OptionComponent<C> {
// OptionComponent BUILDER.
#[fn_with]
#[fn_builder]
pub fn alter_value(&mut self, component: Option<C>) -> &mut Self {
if let Some(component) = component {
self.0 = Some(ArcTypedComponent::new(component));

View file

@ -1,4 +1,4 @@
use crate::{fn_with, AutoDefault};
use crate::{fn_builder, AutoDefault};
#[derive(AutoDefault)]
pub struct OptionId(Option<String>);
@ -10,7 +10,7 @@ impl OptionId {
// OptionId BUILDER.
#[fn_with]
#[fn_builder]
pub fn alter_value(&mut self, value: impl Into<String>) -> &mut Self {
self.0 = Some(value.into().trim().replace(' ', "_"));
self

View file

@ -1,4 +1,4 @@
use crate::{fn_with, AutoDefault};
use crate::{fn_builder, AutoDefault};
#[derive(AutoDefault)]
pub struct OptionName(Option<String>);
@ -10,7 +10,7 @@ impl OptionName {
// OptionName BUILDER.
#[fn_with]
#[fn_builder]
pub fn alter_value(&mut self, value: impl Into<String>) -> &mut Self {
self.0 = Some(value.into().trim().replace(' ', "_"));
self

View file

@ -1,4 +1,4 @@
use crate::{fn_with, AutoDefault};
use crate::{fn_builder, AutoDefault};
#[derive(AutoDefault)]
pub struct OptionString(Option<String>);
@ -10,7 +10,7 @@ impl OptionString {
// OptionString BUILDER.
#[fn_with]
#[fn_builder]
pub fn alter_value(&mut self, value: impl Into<String>) -> &mut Self {
self.0 = Some(value.into().trim().to_owned());
self

View file

@ -1,6 +1,6 @@
use crate::html::Markup;
use crate::locale::{L10n, LanguageIdentifier};
use crate::{fn_with, AutoDefault};
use crate::{fn_builder, AutoDefault};
#[derive(AutoDefault)]
pub struct OptionTranslated(L10n);
@ -12,7 +12,7 @@ impl OptionTranslated {
// OptionTranslated BUILDER.
#[fn_with]
#[fn_builder]
pub fn alter_value(&mut self, value: L10n) -> &mut Self {
self.0 = value;
self