mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-26 21:41:04 +00:00
Use OneOrMany<&AnyString>::as_as_str()
This commit is contained in:
parent
f0112850fa
commit
456df3e535
1 changed files with 1 additions and 7 deletions
|
@ -414,13 +414,7 @@ pub trait ToAsString {
|
|||
|
||||
impl ToAsString for OneOrMany<&AnyString> {
|
||||
fn to_as_string(&self) -> Option<String> {
|
||||
self.as_one()
|
||||
.and_then(|prop| prop.as_as_str())
|
||||
.or_else(|| {
|
||||
self.as_many()
|
||||
.and_then(|props| props.iter().next().and_then(|prop| prop.as_as_str()))
|
||||
})
|
||||
.map(|s| s.to_string())
|
||||
self.as_as_str().map(|s| s.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue