♻️ Migra #[builder_fn] a #[builder_impl]
Sustituye las ~400 anotaciones `#[builder_fn]` método a método por un único `#[builder_impl]` por `impl`/`trait`, en 74 ficheros de pagetop y sus extensiones (admin, bootsier, menu, user).
This commit is contained in:
parent
c34dc02357
commit
1be3d88888
74 changed files with 104 additions and 394 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{AutoDefault, builder_fn, util};
|
||||
use crate::{AutoDefault, builder_impl, util};
|
||||
|
||||
// **< AttrName >***********************************************************************************
|
||||
|
||||
|
|
@ -24,6 +24,7 @@ use crate::{AutoDefault, builder_fn, util};
|
|||
#[derive(AutoDefault, Clone, Debug)]
|
||||
pub struct AttrName(Option<String>);
|
||||
|
||||
#[builder_impl]
|
||||
impl AttrName {
|
||||
/// Crea un nuevo `AttrName` normalizando el valor.
|
||||
pub fn new(name: impl AsRef<str>) -> Self {
|
||||
|
|
@ -33,7 +34,6 @@ impl AttrName {
|
|||
// **< AttrName BUILDER >***********************************************************************
|
||||
|
||||
/// Establece un nombre nuevo normalizando el valor.
|
||||
#[builder_fn]
|
||||
pub fn with_name(mut self, name: impl AsRef<str>) -> Self {
|
||||
self.0 = util::normalize_token(name);
|
||||
self
|
||||
|
|
@ -79,6 +79,7 @@ impl AttrName {
|
|||
#[derive(AutoDefault, Clone, Debug)]
|
||||
pub struct AttrValue(Option<String>);
|
||||
|
||||
#[builder_impl]
|
||||
impl AttrValue {
|
||||
/// Crea un nuevo `AttrValue` normalizando el valor.
|
||||
pub fn new(value: impl AsRef<str>) -> Self {
|
||||
|
|
@ -88,7 +89,6 @@ impl AttrValue {
|
|||
// **< AttrValue BUILDER >**********************************************************************
|
||||
|
||||
/// Establece una cadena nueva normalizando el valor.
|
||||
#[builder_fn]
|
||||
pub fn with_str(mut self, value: impl AsRef<str>) -> Self {
|
||||
self.0 = util::non_blank(value.as_ref()).map(str::to_string);
|
||||
self
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue