♻️ Cambia Self::default() por Tipo::default()
This commit is contained in:
parent
47c47ba9a0
commit
25d32ec5de
21 changed files with 69 additions and 68 deletions
|
|
@ -18,7 +18,7 @@ pub struct Block {
|
|||
|
||||
impl Component for Block {
|
||||
fn new() -> Self {
|
||||
Block::default()
|
||||
Self::default()
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
|
|
|
|||
|
|
@ -33,12 +33,13 @@ pub struct Html(Box<dyn Fn(&mut Context) -> Markup + Send + Sync>);
|
|||
|
||||
impl Default for Html {
|
||||
fn default() -> Self {
|
||||
Html::with(|_| html! {})
|
||||
Self::with(|_| html! {})
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for Html {
|
||||
fn new() -> Self {
|
||||
Html::default()
|
||||
Self::default()
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ impl Default for Intro {
|
|||
|
||||
impl Component for Intro {
|
||||
fn new() -> Self {
|
||||
Intro::default()
|
||||
Self::default()
|
||||
}
|
||||
|
||||
fn setup_before_prepare(&mut self, cx: &mut Context) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ pub struct ActionsList(RwLock<Vec<ActionBox>>);
|
|||
|
||||
impl ActionsList {
|
||||
pub fn new() -> Self {
|
||||
ActionsList::default()
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn add(&mut self, action: ActionBox) {
|
||||
|
|
|
|||
|
|
@ -208,12 +208,12 @@ pub struct Children(Vec<Child>);
|
|||
impl Children {
|
||||
/// Crea una lista vacía.
|
||||
pub fn new() -> Self {
|
||||
Children::default()
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Crea una lista con un componente hijo inicial.
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ impl Favicon {
|
|||
/// Equivalente a `Favicon::default()`. Se recomienda iniciar la secuencia de configuración
|
||||
/// desde aquí.
|
||||
pub fn new() -> Self {
|
||||
Favicon::default()
|
||||
Self::default()
|
||||
}
|
||||
|
||||
// **< Favicon BUILDER >************************************************************************
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ impl JavaScript {
|
|||
///
|
||||
/// Equivale a `<script src="...">`.
|
||||
pub fn from(path: impl Into<String>) -> Self {
|
||||
JavaScript {
|
||||
Self {
|
||||
source: Source::From(path.into()),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ impl JavaScript {
|
|||
/// Equivale a `<script src="..." defer>`. Suele ser la opción recomendada para scripts no
|
||||
/// críticos.
|
||||
pub fn defer(path: impl Into<String>) -> Self {
|
||||
JavaScript {
|
||||
Self {
|
||||
source: Source::Defer(path.into()),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ impl JavaScript {
|
|||
///
|
||||
/// Equivale a `<script src="..." async>`. **No garantiza** el orden relativo con otros scripts.
|
||||
pub fn asynchronous(path: impl Into<String>) -> Self {
|
||||
JavaScript {
|
||||
Self {
|
||||
source: Source::Async(path.into()),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ impl JavaScript {
|
|||
where
|
||||
F: Fn(&mut Context) -> String + Send + Sync + 'static,
|
||||
{
|
||||
JavaScript {
|
||||
Self {
|
||||
source: Source::Inline(name.into(), Box::new(f)),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ impl JavaScript {
|
|||
where
|
||||
F: Fn(&mut Context) -> String + Send + Sync + 'static,
|
||||
{
|
||||
JavaScript {
|
||||
Self {
|
||||
source: Source::OnLoad(name.into(), Box::new(f)),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ impl JavaScript {
|
|||
where
|
||||
F: Fn(&mut Context) -> String + Send + Sync + 'static,
|
||||
{
|
||||
JavaScript {
|
||||
Self {
|
||||
source: Source::OnLoadAsync(name.into(), Box::new(f)),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ impl StyleSheet {
|
|||
///
|
||||
/// Equivale a `<link rel="stylesheet" href="...">`.
|
||||
pub fn from(path: impl Into<String>) -> Self {
|
||||
StyleSheet {
|
||||
Self {
|
||||
source: Source::From(path.into()),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ impl StyleSheet {
|
|||
where
|
||||
F: Fn(&mut Context) -> String + Send + Sync + 'static,
|
||||
{
|
||||
StyleSheet {
|
||||
Self {
|
||||
source: Source::Inline(name.into(), Box::new(f)),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ pub struct AttrClasses(Vec<String>);
|
|||
|
||||
impl AttrClasses {
|
||||
pub fn new(classes: impl AsRef<str>) -> Self {
|
||||
AttrClasses::default().with_value(ClassesOp::Prepend, classes)
|
||||
Self::default().with_value(ClassesOp::Prepend, classes)
|
||||
}
|
||||
|
||||
// **< AttrClasses BUILDER >********************************************************************
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ pub struct L10n {
|
|||
impl L10n {
|
||||
/// **n** = *“native”*. Crea una instancia con una cadena literal sin traducción.
|
||||
pub fn n(text: impl Into<Cow<'static, str>>) -> Self {
|
||||
L10n {
|
||||
Self {
|
||||
op: L10nOp::Text(text.into()),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ impl L10n {
|
|||
/// **l** = *“lookup”*. Crea una instancia para traducir usando una clave del conjunto de
|
||||
/// traducciones predefinidas.
|
||||
pub fn l(key: impl Into<Cow<'static, str>>) -> Self {
|
||||
L10n {
|
||||
Self {
|
||||
op: L10nOp::Translate(key.into()),
|
||||
..Default::default()
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ impl L10n {
|
|||
/// **t** = *“translate”*. Crea una instancia para traducir usando una clave de un conjunto de
|
||||
/// traducciones específico.
|
||||
pub fn t(key: impl Into<Cow<'static, str>>, locales: &'static Locales) -> Self {
|
||||
L10n {
|
||||
Self {
|
||||
op: L10nOp::Translate(key.into()),
|
||||
locales,
|
||||
..Default::default()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue