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
48
49
50
51
macro_rules! deserialize_enum_str {
($name:ident) => {
impl ::serde::Deserialize for $name {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: ::serde::Deserializer
{
struct Visitor;
impl ::serde::de::Visitor for Visitor {
type Value = $name;
fn expecting(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
formatter.write_str("$name")
}
fn visit_str<E>(self, v: &str) -> Result<$name, E>
where E: ::serde::de::Error
{
match v.parse::<$name>() {
Ok(v) => Ok(v),
Err(m) => Err(E::custom(m)),
}
}
}
deserializer.deserialize_str(Visitor)
}
}
}
}
mod annotation;
mod cargo;
mod cdecl;
mod config;
mod items;
mod library;
mod mangle;
mod rename;
mod rust_lib;
mod utilities;
mod writer;
pub use self::cargo::*;
pub use self::config::*;
pub use self::library::{GeneratedBindings, Library};