convertor 2.6.12

A profile converter for surge/clash.
Documentation
1
2
3
4
5
6
7
8
9
10
pub trait NonEmptyOptStr<T> {
    fn filter_non_empty(&self) -> Option<&str>;
}

impl<T: AsRef<str>> NonEmptyOptStr<Option<T>> for Option<T> {
    fn filter_non_empty(&self) -> Option<&str> {
        self.as_ref()
            .and_then(|s| (!s.as_ref().trim().is_empty()).then_some(s.as_ref().trim()))
    }
}