♻️ Cambia Self::default() por Tipo::default()

This commit is contained in:
Manuel Cillero 2025-12-28 13:18:18 +01:00
parent 47c47ba9a0
commit 25d32ec5de
21 changed files with 69 additions and 68 deletions

View file

@ -22,7 +22,7 @@ pub struct Container {
impl Component for Container { impl Component for Container {
fn new() -> Self { fn new() -> Self {
Container::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {
@ -82,7 +82,7 @@ impl Component for Container {
impl Container { impl Container {
/// Crea un contenedor de tipo `Main` (`<main>`). /// Crea un contenedor de tipo `Main` (`<main>`).
pub fn main() -> Self { pub fn main() -> Self {
Container { Self {
container_kind: container::Kind::Main, container_kind: container::Kind::Main,
..Default::default() ..Default::default()
} }
@ -90,7 +90,7 @@ impl Container {
/// Crea un contenedor de tipo `Header` (`<header>`). /// Crea un contenedor de tipo `Header` (`<header>`).
pub fn header() -> Self { pub fn header() -> Self {
Container { Self {
container_kind: container::Kind::Header, container_kind: container::Kind::Header,
..Default::default() ..Default::default()
} }
@ -98,7 +98,7 @@ impl Container {
/// Crea un contenedor de tipo `Footer` (`<footer>`). /// Crea un contenedor de tipo `Footer` (`<footer>`).
pub fn footer() -> Self { pub fn footer() -> Self {
Container { Self {
container_kind: container::Kind::Footer, container_kind: container::Kind::Footer,
..Default::default() ..Default::default()
} }
@ -106,7 +106,7 @@ impl Container {
/// Crea un contenedor de tipo `Section` (`<section>`). /// Crea un contenedor de tipo `Section` (`<section>`).
pub fn section() -> Self { pub fn section() -> Self {
Container { Self {
container_kind: container::Kind::Section, container_kind: container::Kind::Section,
..Default::default() ..Default::default()
} }
@ -114,7 +114,7 @@ impl Container {
/// Crea un contenedor de tipo `Article` (`<article>`). /// Crea un contenedor de tipo `Article` (`<article>`).
pub fn article() -> Self { pub fn article() -> Self {
Container { Self {
container_kind: container::Kind::Article, container_kind: container::Kind::Article,
..Default::default() ..Default::default()
} }

View file

@ -49,7 +49,7 @@ pub struct Dropdown {
impl Component for Dropdown { impl Component for Dropdown {
fn new() -> Self { fn new() -> Self {
Dropdown::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {

View file

@ -55,7 +55,7 @@ pub struct Item {
impl Component for Item { impl Component for Item {
fn new() -> Self { fn new() -> Self {
Item::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {
@ -158,7 +158,7 @@ impl Component for Item {
impl Item { impl Item {
/// Crea un elemento de tipo texto, mostrado sin interacción. /// Crea un elemento de tipo texto, mostrado sin interacción.
pub fn label(label: L10n) -> Self { pub fn label(label: L10n) -> Self {
Item { Self {
item_kind: ItemKind::Label(label), item_kind: ItemKind::Label(label),
..Default::default() ..Default::default()
} }
@ -170,7 +170,7 @@ impl Item {
/// [`RoutePath`] en función del [`Context`]. El enlace se marca como `active` si la ruta actual /// [`RoutePath`] en función del [`Context`]. El enlace se marca como `active` si la ruta actual
/// del *request* coincide con la ruta de destino (devuelta por `RoutePath::path`). /// del *request* coincide con la ruta de destino (devuelta por `RoutePath::path`).
pub fn link(label: L10n, route: FnPathByContext) -> Self { pub fn link(label: L10n, route: FnPathByContext) -> Self {
Item { Self {
item_kind: ItemKind::Link { item_kind: ItemKind::Link {
label, label,
route, route,
@ -183,7 +183,7 @@ impl Item {
/// Crea un enlace deshabilitado que no permite la interacción. /// Crea un enlace deshabilitado que no permite la interacción.
pub fn link_disabled(label: L10n, route: FnPathByContext) -> Self { pub fn link_disabled(label: L10n, route: FnPathByContext) -> Self {
Item { Self {
item_kind: ItemKind::Link { item_kind: ItemKind::Link {
label, label,
route, route,
@ -196,7 +196,7 @@ impl Item {
/// Crea un enlace que se abre en una nueva ventana o pestaña. /// Crea un enlace que se abre en una nueva ventana o pestaña.
pub fn link_blank(label: L10n, route: FnPathByContext) -> Self { pub fn link_blank(label: L10n, route: FnPathByContext) -> Self {
Item { Self {
item_kind: ItemKind::Link { item_kind: ItemKind::Link {
label, label,
route, route,
@ -209,7 +209,7 @@ impl Item {
/// Crea un enlace inicialmente deshabilitado que se abriría en una nueva ventana. /// Crea un enlace inicialmente deshabilitado que se abriría en una nueva ventana.
pub fn link_blank_disabled(label: L10n, route: FnPathByContext) -> Self { pub fn link_blank_disabled(label: L10n, route: FnPathByContext) -> Self {
Item { Self {
item_kind: ItemKind::Link { item_kind: ItemKind::Link {
label, label,
route, route,
@ -222,7 +222,7 @@ impl Item {
/// Crea un botón de acción local, sin navegación asociada. /// Crea un botón de acción local, sin navegación asociada.
pub fn button(label: L10n) -> Self { pub fn button(label: L10n) -> Self {
Item { Self {
item_kind: ItemKind::Button { item_kind: ItemKind::Button {
label, label,
disabled: false, disabled: false,
@ -233,7 +233,7 @@ impl Item {
/// Crea un botón deshabilitado. /// Crea un botón deshabilitado.
pub fn button_disabled(label: L10n) -> Self { pub fn button_disabled(label: L10n) -> Self {
Item { Self {
item_kind: ItemKind::Button { item_kind: ItemKind::Button {
label, label,
disabled: true, disabled: true,
@ -244,7 +244,7 @@ impl Item {
/// Crea un encabezado para un grupo de elementos dentro del menú. /// Crea un encabezado para un grupo de elementos dentro del menú.
pub fn header(label: L10n) -> Self { pub fn header(label: L10n) -> Self {
Item { Self {
item_kind: ItemKind::Header(label), item_kind: ItemKind::Header(label),
..Default::default() ..Default::default()
} }
@ -252,7 +252,7 @@ impl Item {
/// Crea un separador visual entre bloques de elementos. /// Crea un separador visual entre bloques de elementos.
pub fn divider() -> Self { pub fn divider() -> Self {
Item { Self {
item_kind: ItemKind::Divider, item_kind: ItemKind::Divider,
..Default::default() ..Default::default()
} }

View file

@ -23,7 +23,7 @@ pub struct Icon {
impl Component for Icon { impl Component for Icon {
fn new() -> Self { fn new() -> Self {
Icon::default() Self::default()
} }
fn setup_before_prepare(&mut self, _cx: &mut Context) { fn setup_before_prepare(&mut self, _cx: &mut Context) {
@ -75,22 +75,22 @@ impl Component for Icon {
impl Icon { impl Icon {
pub fn font() -> Self { pub fn font() -> Self {
Icon::default().with_icon_kind(IconKind::Font(FontSize::default())) Self::default().with_icon_kind(IconKind::Font(FontSize::default()))
} }
pub fn font_sized(font_size: FontSize) -> Self { pub fn font_sized(font_size: FontSize) -> Self {
Icon::default().with_icon_kind(IconKind::Font(font_size)) Self::default().with_icon_kind(IconKind::Font(font_size))
} }
pub fn svg(shapes: Markup) -> Self { pub fn svg(shapes: Markup) -> Self {
Icon::default().with_icon_kind(IconKind::Svg { Self::default().with_icon_kind(IconKind::Svg {
shapes, shapes,
viewbox: AttrValue::default(), viewbox: AttrValue::default(),
}) })
} }
pub fn svg_with_viewbox(shapes: Markup, viewbox: impl AsRef<str>) -> Self { pub fn svg_with_viewbox(shapes: Markup, viewbox: impl AsRef<str>) -> Self {
Icon::default().with_icon_kind(IconKind::Svg { Self::default().with_icon_kind(IconKind::Svg {
shapes, shapes,
viewbox: AttrValue::new(viewbox), viewbox: AttrValue::new(viewbox),
}) })

View file

@ -25,7 +25,7 @@ pub struct Image {
impl Component for Image { impl Component for Image {
fn new() -> Self { fn new() -> Self {
Image::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {
@ -73,7 +73,7 @@ impl Component for Image {
impl Image { impl Image {
/// Crea rápidamente una imagen especificando su origen. /// Crea rápidamente una imagen especificando su origen.
pub fn with(source: image::Source) -> Self { pub fn with(source: image::Source) -> Self {
Image::default().with_source(source) Self::default().with_source(source)
} }
// **< Image BUILDER >************************************************************************** // **< Image BUILDER >**************************************************************************

View file

@ -26,7 +26,7 @@ pub struct Nav {
impl Component for Nav { impl Component for Nav {
fn new() -> Self { fn new() -> Self {
Nav::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {
@ -59,17 +59,17 @@ impl Component for Nav {
impl Nav { impl Nav {
/// Crea un `Nav` usando pestañas para los elementos (*Tabs*). /// Crea un `Nav` usando pestañas para los elementos (*Tabs*).
pub fn tabs() -> Self { pub fn tabs() -> Self {
Nav::default().with_kind(nav::Kind::Tabs) Self::default().with_kind(nav::Kind::Tabs)
} }
/// Crea un `Nav` usando botones para los elementos (*Pills*). /// Crea un `Nav` usando botones para los elementos (*Pills*).
pub fn pills() -> Self { pub fn pills() -> Self {
Nav::default().with_kind(nav::Kind::Pills) Self::default().with_kind(nav::Kind::Pills)
} }
/// Crea un `Nav` usando elementos subrayados (*Underline*). /// Crea un `Nav` usando elementos subrayados (*Underline*).
pub fn underline() -> Self { pub fn underline() -> Self {
Nav::default().with_kind(nav::Kind::Underline) Self::default().with_kind(nav::Kind::Underline)
} }
// **< Nav BUILDER >**************************************************************************** // **< Nav BUILDER >****************************************************************************

View file

@ -88,7 +88,7 @@ pub struct Item {
impl Component for Item { impl Component for Item {
fn new() -> Self { fn new() -> Self {
Item::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {
@ -196,7 +196,7 @@ impl Component for Item {
impl Item { impl Item {
/// Crea un elemento de tipo texto, mostrado sin interacción. /// Crea un elemento de tipo texto, mostrado sin interacción.
pub fn label(label: L10n) -> Self { pub fn label(label: L10n) -> Self {
Item { Self {
item_kind: ItemKind::Label(label), item_kind: ItemKind::Label(label),
..Default::default() ..Default::default()
} }
@ -208,7 +208,7 @@ impl Item {
/// [`RoutePath`] en función del [`Context`]. El enlace se marca como `active` si la ruta actual /// [`RoutePath`] en función del [`Context`]. El enlace se marca como `active` si la ruta actual
/// del *request* coincide con la ruta de destino (devuelta por `RoutePath::path`). /// del *request* coincide con la ruta de destino (devuelta por `RoutePath::path`).
pub fn link(label: L10n, route: FnPathByContext) -> Self { pub fn link(label: L10n, route: FnPathByContext) -> Self {
Item { Self {
item_kind: ItemKind::Link { item_kind: ItemKind::Link {
label, label,
route, route,
@ -221,7 +221,7 @@ impl Item {
/// Crea un enlace deshabilitado que no permite la interacción. /// Crea un enlace deshabilitado que no permite la interacción.
pub fn link_disabled(label: L10n, route: FnPathByContext) -> Self { pub fn link_disabled(label: L10n, route: FnPathByContext) -> Self {
Item { Self {
item_kind: ItemKind::Link { item_kind: ItemKind::Link {
label, label,
route, route,
@ -234,7 +234,7 @@ impl Item {
/// Crea un enlace que se abre en una nueva ventana o pestaña. /// Crea un enlace que se abre en una nueva ventana o pestaña.
pub fn link_blank(label: L10n, route: FnPathByContext) -> Self { pub fn link_blank(label: L10n, route: FnPathByContext) -> Self {
Item { Self {
item_kind: ItemKind::Link { item_kind: ItemKind::Link {
label, label,
route, route,
@ -247,7 +247,7 @@ impl Item {
/// Crea un enlace inicialmente deshabilitado que se abriría en una nueva ventana. /// Crea un enlace inicialmente deshabilitado que se abriría en una nueva ventana.
pub fn link_blank_disabled(label: L10n, route: FnPathByContext) -> Self { pub fn link_blank_disabled(label: L10n, route: FnPathByContext) -> Self {
Item { Self {
item_kind: ItemKind::Link { item_kind: ItemKind::Link {
label, label,
route, route,
@ -263,7 +263,7 @@ impl Item {
/// El contenido se renderiza tal cual lo devuelve el componente [`Html`], dentro de un `<li>` /// El contenido se renderiza tal cual lo devuelve el componente [`Html`], dentro de un `<li>`
/// con las clases de navegación asociadas a [`Item`]. /// con las clases de navegación asociadas a [`Item`].
pub fn html(html: Html) -> Self { pub fn html(html: Html) -> Self {
Item { Self {
item_kind: ItemKind::Html(Typed::with(html)), item_kind: ItemKind::Html(Typed::with(html)),
..Default::default() ..Default::default()
} }
@ -275,7 +275,7 @@ impl Item {
/// lista de elementos** del [`Dropdown`]; el resto de propiedades del componente no afectarán /// lista de elementos** del [`Dropdown`]; el resto de propiedades del componente no afectarán
/// a su representación en [`Nav`]. /// a su representación en [`Nav`].
pub fn dropdown(menu: Dropdown) -> Self { pub fn dropdown(menu: Dropdown) -> Self {
Item { Self {
item_kind: ItemKind::Dropdown(Typed::with(menu)), item_kind: ItemKind::Dropdown(Typed::with(menu)),
..Default::default() ..Default::default()
} }

View file

@ -29,7 +29,7 @@ pub struct Brand {
impl Component for Brand { impl Component for Brand {
fn new() -> Self { fn new() -> Self {
Brand::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {

View file

@ -32,7 +32,7 @@ pub struct Navbar {
impl Component for Navbar { impl Component for Navbar {
fn new() -> Self { fn new() -> Self {
Navbar::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {
@ -169,37 +169,37 @@ impl Component for Navbar {
impl Navbar { impl Navbar {
/// Crea una barra de navegación **simple**, sin marca y sin botón. /// Crea una barra de navegación **simple**, sin marca y sin botón.
pub fn simple() -> Self { pub fn simple() -> Self {
Navbar::default().with_layout(navbar::Layout::Simple) Self::default().with_layout(navbar::Layout::Simple)
} }
/// Crea una barra de navegación **simple pero colapsable**, con botón a la izquierda. /// Crea una barra de navegación **simple pero colapsable**, con botón a la izquierda.
pub fn simple_toggle() -> Self { pub fn simple_toggle() -> Self {
Navbar::default().with_layout(navbar::Layout::SimpleToggle) Self::default().with_layout(navbar::Layout::SimpleToggle)
} }
/// Crea una barra de navegación **con marca a la izquierda**, siempre visible. /// Crea una barra de navegación **con marca a la izquierda**, siempre visible.
pub fn simple_brand_left(brand: navbar::Brand) -> Self { pub fn simple_brand_left(brand: navbar::Brand) -> Self {
Navbar::default().with_layout(navbar::Layout::SimpleBrandLeft(Typed::with(brand))) Self::default().with_layout(navbar::Layout::SimpleBrandLeft(Typed::with(brand)))
} }
/// Crea una barra de navegación con **marca a la izquierda** y **botón a la derecha**. /// Crea una barra de navegación con **marca a la izquierda** y **botón a la derecha**.
pub fn brand_left(brand: navbar::Brand) -> Self { pub fn brand_left(brand: navbar::Brand) -> Self {
Navbar::default().with_layout(navbar::Layout::BrandLeft(Typed::with(brand))) Self::default().with_layout(navbar::Layout::BrandLeft(Typed::with(brand)))
} }
/// Crea una barra de navegación con **botón a la izquierda** y **marca a la derecha**. /// Crea una barra de navegación con **botón a la izquierda** y **marca a la derecha**.
pub fn brand_right(brand: navbar::Brand) -> Self { pub fn brand_right(brand: navbar::Brand) -> Self {
Navbar::default().with_layout(navbar::Layout::BrandRight(Typed::with(brand))) Self::default().with_layout(navbar::Layout::BrandRight(Typed::with(brand)))
} }
/// Crea una barra de navegación cuyo contenido se muestra en un **offcanvas**. /// Crea una barra de navegación cuyo contenido se muestra en un **offcanvas**.
pub fn offcanvas(oc: Offcanvas) -> Self { pub fn offcanvas(oc: Offcanvas) -> Self {
Navbar::default().with_layout(navbar::Layout::Offcanvas(Typed::with(oc))) Self::default().with_layout(navbar::Layout::Offcanvas(Typed::with(oc)))
} }
/// Crea una barra de navegación con **marca a la izquierda** y contenido en **offcanvas**. /// Crea una barra de navegación con **marca a la izquierda** y contenido en **offcanvas**.
pub fn offcanvas_brand_left(brand: navbar::Brand, oc: Offcanvas) -> Self { pub fn offcanvas_brand_left(brand: navbar::Brand, oc: Offcanvas) -> Self {
Navbar::default().with_layout(navbar::Layout::OffcanvasBrandLeft( Self::default().with_layout(navbar::Layout::OffcanvasBrandLeft(
Typed::with(brand), Typed::with(brand),
Typed::with(oc), Typed::with(oc),
)) ))
@ -207,7 +207,7 @@ impl Navbar {
/// Crea una barra de navegación con **marca a la derecha** y contenido en **offcanvas**. /// Crea una barra de navegación con **marca a la derecha** y contenido en **offcanvas**.
pub fn offcanvas_brand_right(brand: navbar::Brand, oc: Offcanvas) -> Self { pub fn offcanvas_brand_right(brand: navbar::Brand, oc: Offcanvas) -> Self {
Navbar::default().with_layout(navbar::Layout::OffcanvasBrandRight( Self::default().with_layout(navbar::Layout::OffcanvasBrandRight(
Typed::with(brand), Typed::with(brand),
Typed::with(oc), Typed::with(oc),
)) ))

View file

@ -26,7 +26,7 @@ pub enum Item {
impl Component for Item { impl Component for Item {
fn new() -> Self { fn new() -> Self {
Item::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {

View file

@ -45,7 +45,7 @@ pub struct Offcanvas {
impl Component for Offcanvas { impl Component for Offcanvas {
fn new() -> Self { fn new() -> Self {
Offcanvas::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {

View file

@ -18,7 +18,7 @@ pub struct Block {
impl Component for Block { impl Component for Block {
fn new() -> Self { fn new() -> Self {
Block::default() Self::default()
} }
fn id(&self) -> Option<String> { fn id(&self) -> Option<String> {

View file

@ -33,12 +33,13 @@ pub struct Html(Box<dyn Fn(&mut Context) -> Markup + Send + Sync>);
impl Default for Html { impl Default for Html {
fn default() -> Self { fn default() -> Self {
Html::with(|_| html! {}) Self::with(|_| html! {})
} }
} }
impl Component for Html { impl Component for Html {
fn new() -> Self { fn new() -> Self {
Html::default() Self::default()
} }
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup { fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {

View file

@ -106,7 +106,7 @@ impl Default for Intro {
impl Component for Intro { impl Component for Intro {
fn new() -> Self { fn new() -> Self {
Intro::default() Self::default()
} }
fn setup_before_prepare(&mut self, cx: &mut Context) { fn setup_before_prepare(&mut self, cx: &mut Context) {

View file

@ -10,7 +10,7 @@ pub struct ActionsList(RwLock<Vec<ActionBox>>);
impl ActionsList { impl ActionsList {
pub fn new() -> Self { pub fn new() -> Self {
ActionsList::default() Self::default()
} }
pub fn add(&mut self, action: ActionBox) { pub fn add(&mut self, action: ActionBox) {

View file

@ -208,12 +208,12 @@ pub struct Children(Vec<Child>);
impl Children { impl Children {
/// Crea una lista vacía. /// Crea una lista vacía.
pub fn new() -> Self { pub fn new() -> Self {
Children::default() Self::default()
} }
/// Crea una lista con un componente hijo inicial. /// Crea una lista con un componente hijo inicial.
pub fn with(child: Child) -> Self { pub fn with(child: Child) -> Self {
Children::default().with_child(ChildOp::Add(child)) Self::default().with_child(ChildOp::Add(child))
} }
/// Fusiona varias listas de `Children` en una sola. /// Fusiona varias listas de `Children` en una sola.

View file

@ -49,7 +49,7 @@ impl Favicon {
/// Equivalente a `Favicon::default()`. Se recomienda iniciar la secuencia de configuración /// Equivalente a `Favicon::default()`. Se recomienda iniciar la secuencia de configuración
/// desde aquí. /// desde aquí.
pub fn new() -> Self { pub fn new() -> Self {
Favicon::default() Self::default()
} }
// **< Favicon BUILDER >************************************************************************ // **< Favicon BUILDER >************************************************************************

View file

@ -88,7 +88,7 @@ impl JavaScript {
/// ///
/// Equivale a `<script src="...">`. /// Equivale a `<script src="...">`.
pub fn from(path: impl Into<String>) -> Self { pub fn from(path: impl Into<String>) -> Self {
JavaScript { Self {
source: Source::From(path.into()), source: Source::From(path.into()),
..Default::default() ..Default::default()
} }
@ -100,7 +100,7 @@ impl JavaScript {
/// Equivale a `<script src="..." defer>`. Suele ser la opción recomendada para scripts no /// Equivale a `<script src="..." defer>`. Suele ser la opción recomendada para scripts no
/// críticos. /// críticos.
pub fn defer(path: impl Into<String>) -> Self { pub fn defer(path: impl Into<String>) -> Self {
JavaScript { Self {
source: Source::Defer(path.into()), source: Source::Defer(path.into()),
..Default::default() ..Default::default()
} }
@ -111,7 +111,7 @@ impl JavaScript {
/// ///
/// Equivale a `<script src="..." async>`. **No garantiza** el orden relativo con otros scripts. /// Equivale a `<script src="..." async>`. **No garantiza** el orden relativo con otros scripts.
pub fn asynchronous(path: impl Into<String>) -> Self { pub fn asynchronous(path: impl Into<String>) -> Self {
JavaScript { Self {
source: Source::Async(path.into()), source: Source::Async(path.into()),
..Default::default() ..Default::default()
} }
@ -127,7 +127,7 @@ impl JavaScript {
where where
F: Fn(&mut Context) -> String + Send + Sync + 'static, F: Fn(&mut Context) -> String + Send + Sync + 'static,
{ {
JavaScript { Self {
source: Source::Inline(name.into(), Box::new(f)), source: Source::Inline(name.into(), Box::new(f)),
..Default::default() ..Default::default()
} }
@ -147,7 +147,7 @@ impl JavaScript {
where where
F: Fn(&mut Context) -> String + Send + Sync + 'static, F: Fn(&mut Context) -> String + Send + Sync + 'static,
{ {
JavaScript { Self {
source: Source::OnLoad(name.into(), Box::new(f)), source: Source::OnLoad(name.into(), Box::new(f)),
..Default::default() ..Default::default()
} }
@ -165,7 +165,7 @@ impl JavaScript {
where where
F: Fn(&mut Context) -> String + Send + Sync + 'static, F: Fn(&mut Context) -> String + Send + Sync + 'static,
{ {
JavaScript { Self {
source: Source::OnLoadAsync(name.into(), Box::new(f)), source: Source::OnLoadAsync(name.into(), Box::new(f)),
..Default::default() ..Default::default()
} }

View file

@ -91,7 +91,7 @@ impl StyleSheet {
/// ///
/// Equivale a `<link rel="stylesheet" href="...">`. /// Equivale a `<link rel="stylesheet" href="...">`.
pub fn from(path: impl Into<String>) -> Self { pub fn from(path: impl Into<String>) -> Self {
StyleSheet { Self {
source: Source::From(path.into()), source: Source::From(path.into()),
..Default::default() ..Default::default()
} }
@ -107,7 +107,7 @@ impl StyleSheet {
where where
F: Fn(&mut Context) -> String + Send + Sync + 'static, F: Fn(&mut Context) -> String + Send + Sync + 'static,
{ {
StyleSheet { Self {
source: Source::Inline(name.into(), Box::new(f)), source: Source::Inline(name.into(), Box::new(f)),
..Default::default() ..Default::default()
} }

View file

@ -44,7 +44,7 @@ pub struct AttrClasses(Vec<String>);
impl AttrClasses { impl AttrClasses {
pub fn new(classes: impl AsRef<str>) -> Self { pub fn new(classes: impl AsRef<str>) -> Self {
AttrClasses::default().with_value(ClassesOp::Prepend, classes) Self::default().with_value(ClassesOp::Prepend, classes)
} }
// **< AttrClasses BUILDER >******************************************************************** // **< AttrClasses BUILDER >********************************************************************

View file

@ -66,7 +66,7 @@ pub struct L10n {
impl L10n { impl L10n {
/// **n** = *“native”*. Crea una instancia con una cadena literal sin traducción. /// **n** = *“native”*. Crea una instancia con una cadena literal sin traducción.
pub fn n(text: impl Into<Cow<'static, str>>) -> Self { pub fn n(text: impl Into<Cow<'static, str>>) -> Self {
L10n { Self {
op: L10nOp::Text(text.into()), op: L10nOp::Text(text.into()),
..Default::default() ..Default::default()
} }
@ -75,7 +75,7 @@ impl L10n {
/// **l** = *“lookup”*. Crea una instancia para traducir usando una clave del conjunto de /// **l** = *“lookup”*. Crea una instancia para traducir usando una clave del conjunto de
/// traducciones predefinidas. /// traducciones predefinidas.
pub fn l(key: impl Into<Cow<'static, str>>) -> Self { pub fn l(key: impl Into<Cow<'static, str>>) -> Self {
L10n { Self {
op: L10nOp::Translate(key.into()), op: L10nOp::Translate(key.into()),
..Default::default() ..Default::default()
} }
@ -84,7 +84,7 @@ impl L10n {
/// **t** = *“translate”*. Crea una instancia para traducir usando una clave de un conjunto de /// **t** = *“translate”*. Crea una instancia para traducir usando una clave de un conjunto de
/// traducciones específico. /// traducciones específico.
pub fn t(key: impl Into<Cow<'static, str>>, locales: &'static Locales) -> Self { pub fn t(key: impl Into<Cow<'static, str>>, locales: &'static Locales) -> Self {
L10n { Self {
op: L10nOp::Translate(key.into()), op: L10nOp::Translate(key.into()),
locales, locales,
..Default::default() ..Default::default()