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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use syn::{
Meta, NestedMeta,
};
/// Iterates over an iterator of syn::NestedMeta,
/// unwrapping it into a syn::Meta and passing it into the `f` closure.
pub(crate) fn with_nested_meta<I, F>(attr_name: &str, iter: I, mut f: F)
where
F: FnMut(Meta),
I: IntoIterator<Item = NestedMeta>,
{
for repr in iter {
match repr {
NestedMeta::Meta(attr) => {
f(attr);
}
NestedMeta::Literal(lit) => {
panic!(
"\
the #[{}(...)] attribute does not allow \
literals in the attribute list:\n{:?}\
",
attr_name, lit
);
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////