🏷️ 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};
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
use crate::{db::*};
|
||||
use crate::db::*;
|
||||
|
||||
use std::sync::RwLock;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,18 +25,15 @@ impl AssetsTrait for HeadScript {
|
|||
}
|
||||
|
||||
impl HeadScript {
|
||||
pub fn named<S>(path: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
pub fn named(path: impl Into<String>) -> Self {
|
||||
HeadScript {
|
||||
path: path.into(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_code(mut self, code: &str) -> Self {
|
||||
self.code = code.trim().to_owned();
|
||||
pub fn with_code(mut self, code: impl Into<String>) -> Self {
|
||||
self.code = code.into().trim().to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,18 +25,15 @@ impl AssetsTrait for HeadStyles {
|
|||
}
|
||||
|
||||
impl HeadStyles {
|
||||
pub fn named<S>(path: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
pub fn named(path: impl Into<String>) -> Self {
|
||||
HeadStyles {
|
||||
path: path.into(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_styles(mut self, styles: &str) -> Self {
|
||||
self.styles = styles.trim().to_owned();
|
||||
pub fn with_styles(mut self, styles: impl Into<String>) -> Self {
|
||||
self.styles = styles.into().trim().to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,10 +41,7 @@ impl AssetsTrait for JavaScript {
|
|||
}
|
||||
|
||||
impl JavaScript {
|
||||
pub fn at<S>(path: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
pub fn at(path: impl Into<String>) -> Self {
|
||||
JavaScript {
|
||||
path: path.into(),
|
||||
..Default::default()
|
||||
|
|
|
|||
|
|
@ -39,10 +39,7 @@ impl AssetsTrait for StyleSheet {
|
|||
}
|
||||
|
||||
impl StyleSheet {
|
||||
pub fn at<S>(path: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
pub fn at(path: impl Into<String>) -> Self {
|
||||
StyleSheet {
|
||||
path: path.into(),
|
||||
..Default::default()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue