mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Add From<&String> for Classes implementation
This commit is contained in:
parent
f794d555e3
commit
ff41a69c70
@ -101,6 +101,13 @@ impl From<String> for Classes {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&String> for Classes {
|
||||
fn from(t: &String) -> Self {
|
||||
let set = t.split_whitespace().map(String::from).collect();
|
||||
Self { set }
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: AsRef<str>> From<Vec<T>> for Classes {
|
||||
fn from(t: Vec<T>) -> Self {
|
||||
let set = t.iter().map(|x| x.as_ref().to_string()).collect();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user