Add From<&String> for Classes implementation

This commit is contained in:
Justin Starry 2019-09-24 23:31:04 -04:00
parent f794d555e3
commit ff41a69c70

View File

@ -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();