enum_dispatch/
filter_attrs.rs
1pub trait FilterAttrs<'a> {
6 type Ret: Iterator<Item = &'a syn::Attribute>;
7
8 fn outer(self) -> Self::Ret;
9}
10
11impl<'a, T> FilterAttrs<'a> for T
13where
14 T: IntoIterator<Item = &'a syn::Attribute>,
15{
16 type Ret = ::std::iter::Filter<T::IntoIter, fn(&&syn::Attribute) -> bool>;
17
18 fn outer(self) -> Self::Ret {
19 fn is_outer(attr: &&syn::Attribute) -> bool {
20 matches!(attr.style, syn::AttrStyle::Outer)
21 }
22 self.into_iter().filter(is_outer)
23 }
24}