🏷️ Improve ergonomic use of Into<String>
This commit is contained in:
parent
fefb3ed249
commit
c123c3a780
5 changed files with 9 additions and 21 deletions
|
|
@ -4,7 +4,7 @@ use crate::core::theme::all::THEMES;
|
||||||
use crate::{service, trace, LazyStatic};
|
use crate::{service, trace, LazyStatic};
|
||||||
|
|
||||||
#[cfg(feature = "database")]
|
#[cfg(feature = "database")]
|
||||||
use crate::{db::*};
|
use crate::db::*;
|
||||||
|
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,18 +25,15 @@ impl AssetsTrait for HeadScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HeadScript {
|
impl HeadScript {
|
||||||
pub fn named<S>(path: S) -> Self
|
pub fn named(path: impl Into<String>) -> Self {
|
||||||
where
|
|
||||||
S: Into<String>,
|
|
||||||
{
|
|
||||||
HeadScript {
|
HeadScript {
|
||||||
path: path.into(),
|
path: path.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_code(mut self, code: &str) -> Self {
|
pub fn with_code(mut self, code: impl Into<String>) -> Self {
|
||||||
self.code = code.trim().to_owned();
|
self.code = code.into().trim().to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,18 +25,15 @@ impl AssetsTrait for HeadStyles {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HeadStyles {
|
impl HeadStyles {
|
||||||
pub fn named<S>(path: S) -> Self
|
pub fn named(path: impl Into<String>) -> Self {
|
||||||
where
|
|
||||||
S: Into<String>,
|
|
||||||
{
|
|
||||||
HeadStyles {
|
HeadStyles {
|
||||||
path: path.into(),
|
path: path.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_styles(mut self, styles: &str) -> Self {
|
pub fn with_styles(mut self, styles: impl Into<String>) -> Self {
|
||||||
self.styles = styles.trim().to_owned();
|
self.styles = styles.into().trim().to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,7 @@ impl AssetsTrait for JavaScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl JavaScript {
|
impl JavaScript {
|
||||||
pub fn at<S>(path: S) -> Self
|
pub fn at(path: impl Into<String>) -> Self {
|
||||||
where
|
|
||||||
S: Into<String>,
|
|
||||||
{
|
|
||||||
JavaScript {
|
JavaScript {
|
||||||
path: path.into(),
|
path: path.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,7 @@ impl AssetsTrait for StyleSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StyleSheet {
|
impl StyleSheet {
|
||||||
pub fn at<S>(path: S) -> Self
|
pub fn at(path: impl Into<String>) -> Self {
|
||||||
where
|
|
||||||
S: Into<String>,
|
|
||||||
{
|
|
||||||
StyleSheet {
|
StyleSheet {
|
||||||
path: path.into(),
|
path: path.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue