mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 17:15:43 +00:00
utils: use itertools
utils
This commit is contained in:
@@ -35,7 +35,7 @@ pub fn sanitize(name: &str) -> String {
|
|||||||
.to_string()
|
.to_string()
|
||||||
})
|
})
|
||||||
.filter(|label| !label.is_empty())
|
.filter(|label| !label.is_empty())
|
||||||
.collect::<Vec<_>>()
|
.collect_vec()
|
||||||
.join(".");
|
.join(".");
|
||||||
name.truncate(253);
|
name.truncate(253);
|
||||||
if dot {
|
if dot {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ where
|
|||||||
type Error = <Model as TryFrom<&'m Message>>::Error;
|
type Error = <Model as TryFrom<&'m Message>>::Error;
|
||||||
|
|
||||||
fn try_from(value: &'m Vec<Message>) -> Result<Self, Self::Error> {
|
fn try_from(value: &'m Vec<Message>) -> Result<Self, Self::Error> {
|
||||||
Ok(Self(value.into_iter().map_try_into().try_collect()?))
|
Ok(Self(value.iter().map_try_into().try_collect()?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user