1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use syn::NestedMeta;
use util::PathList;
use {FromMeta, Result};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ForwardAttrs {
All,
Only(PathList),
}
impl ForwardAttrs {
pub fn is_empty(&self) -> bool {
match *self {
ForwardAttrs::All => false,
ForwardAttrs::Only(ref list) => list.is_empty(),
}
}
}
impl FromMeta for ForwardAttrs {
fn from_word() -> Result<Self> {
Ok(ForwardAttrs::All)
}
fn from_list(nested: &[NestedMeta]) -> Result<Self> {
Ok(ForwardAttrs::Only(PathList::from_list(nested)?))
}
}