🚚 Restore macro name #[fn_builder] for fn_with
This commit is contained in:
parent
2389aad546
commit
a9a5d232a2
36 changed files with 190 additions and 187 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue