Commit 270491f4 authored by Ryan Hunt's avatar Ryan Hunt

Rustfmt

parent e336f80f
......@@ -46,7 +46,9 @@ impl Builder {
#[allow(unused)]
pub fn with_sys_include<S: AsRef<str>>(mut self, include: S) -> Builder {
self.config.sys_includes.push(String::from(include.as_ref()));
self.config
.sys_includes
.push(String::from(include.as_ref()));
self
}
......@@ -117,19 +119,28 @@ impl Builder {
#[allow(unused)]
pub fn include_item<S: AsRef<str>>(mut self, item_name: S) -> Builder {
self.config.export.include.push(String::from(item_name.as_ref()));
self.config
.export
.include
.push(String::from(item_name.as_ref()));
self
}
#[allow(unused)]
pub fn exclude_item<S: AsRef<str>>(mut self, item_name: S) -> Builder {
self.config.export.exclude.push(String::from(item_name.as_ref()));
self.config
.export
.exclude
.push(String::from(item_name.as_ref()));
self
}
#[allow(unused)]
pub fn rename_item<S: AsRef<str>>(mut self, from: S, to: S) -> Builder {
self.config.export.rename.insert(String::from(from.as_ref()), String::from(to.as_ref()));
self.config
.export
.rename
.insert(String::from(from.as_ref()), String::from(to.as_ref()));
self
}
......
......@@ -56,14 +56,12 @@ impl Cargo {
} else {
None
};
let metadata = cargo_metadata::metadata(&toml_path).map_err(|x| {
Error::CargoMetadata(toml_path.to_str().unwrap().to_owned(), x)
})?;
let metadata = cargo_metadata::metadata(&toml_path)
.map_err(|x| Error::CargoMetadata(toml_path.to_str().unwrap().to_owned(), x))?;
// Use the specified binding crate name or infer it from the manifest
let manifest = cargo_toml::manifest(&toml_path).map_err(|x| {
Error::CargoToml(toml_path.to_str().unwrap().to_owned(), x)
})?;
let manifest = cargo_toml::manifest(&toml_path)
.map_err(|x| Error::CargoToml(toml_path.to_str().unwrap().to_owned(), x))?;
let binding_crate_name =
binding_crate_name.map_or(manifest.package.name.clone(), |x| x.to_owned());
......@@ -178,8 +176,7 @@ impl Cargo {
for meta_package in &self.metadata.packages {
if meta_package.name == package.name && meta_package.version == package.version {
for target in &meta_package.targets {
if target.kind.contains(&kind_lib)
|| target.kind.contains(&kind_staticlib)
if target.kind.contains(&kind_lib) || target.kind.contains(&kind_staticlib)
|| target.kind.contains(&kind_rlib)
|| target.kind.contains(&kind_cdylib)
|| target.kind.contains(&kind_dylib)
......
......@@ -109,7 +109,12 @@ impl CDecl {
}
}
fn write<F: Write>(&self, out: &mut SourceWriter<F>, ident: Option<&str>, void_prototype: bool) {
fn write<F: Write>(
&self,
out: &mut SourceWriter<F>,
ident: Option<&str>,
void_prototype: bool,
) {
// Write the type-specifier and type-qualifier first
if self.type_qualifers.len() != 0 {
write!(out, "{} {}", self.type_qualifers, self.type_name);
......@@ -216,7 +221,12 @@ impl CDecl {
}
}
pub fn write_func<F: Write>(out: &mut SourceWriter<F>, f: &Function, layout_vertical: bool, void_prototype: bool) {
pub fn write_func<F: Write>(
out: &mut SourceWriter<F>,
f: &Function,
layout_vertical: bool,
void_prototype: bool,
) {
&CDecl::from_func(f, layout_vertical).write(out, Some(&f.name), void_prototype);
}
......
......@@ -25,9 +25,11 @@ impl Dependencies {
// Sort untagged enums and opaque structs into their own layers because they don't
// depend on each other or anything else.
let ordering = |a: &ItemContainer, b: &ItemContainer| match (a, b) {
(&ItemContainer::Enum(ref x), &ItemContainer::Enum(ref y)) if x.tag.is_none() && y.tag.is_none() => {
(&ItemContainer::Enum(ref x), &ItemContainer::Enum(ref y))
if x.tag.is_none() && y.tag.is_none() =>
{
x.name.cmp(&y.name)
},
}
(&ItemContainer::Enum(ref x), _) if x.tag.is_none() => Ordering::Less,
(_, &ItemContainer::Enum(ref x)) if x.tag.is_none() => Ordering::Greater,
......
......@@ -14,28 +14,50 @@ pub enum Error {
CargoMetadata(String, CargoMetadataError),
CargoToml(String, CargoTomlError),
CargoExpand(String, CargoExpandError),
ParseSyntaxError{crate_name: String, src_path: String, error: ParseError},
ParseCannotOpenFile{crate_name: String, src_path: String},
ParseSyntaxError {
crate_name: String,
src_path: String,
error: ParseError,
},
ParseCannotOpenFile {
crate_name: String,
src_path: String,
},
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&Error::CargoMetadata(ref path, ref error) => {
write!(f, "Couldn't execute `cargo metadata` with manifest {:?}: {:?}", path, error)
}
&Error::CargoMetadata(ref path, ref error) => write!(
f,
"Couldn't execute `cargo metadata` with manifest {:?}: {:?}",
path, error
),
&Error::CargoToml(ref path, ref error) => {
write!(f, "Couldn't load manifest file {:?}: {:?}", path, error)
}
&Error::CargoExpand(ref crate_name, ref error) => {
write!(f, "Parsing crate `{}`: couldn't run `cargo rustc --pretty=expanded`: {:?}", crate_name, error)
}
&Error::ParseSyntaxError{ref crate_name, ref src_path, ref error} => {
write!(f, "Parsing crate `{}`:`{}`:\n{:?}", crate_name, src_path, error)
}
&Error::ParseCannotOpenFile{ref crate_name, ref src_path} => {
write!(f, "Parsing crate `{}`: cannot open file `{}`.", crate_name, src_path)
}
&Error::CargoExpand(ref crate_name, ref error) => write!(
f,
"Parsing crate `{}`: couldn't run `cargo rustc --pretty=expanded`: {:?}",
crate_name, error
),
&Error::ParseSyntaxError {
ref crate_name,
ref src_path,
ref error,
} => write!(
f,
"Parsing crate `{}`:`{}`:\n{:?}",
crate_name, src_path, error
),
&Error::ParseCannotOpenFile {
ref crate_name,
ref src_path,
} => write!(
f,
"Parsing crate `{}`: cannot open file `{}`.",
crate_name, src_path
),
}
}
}
......@@ -50,8 +50,11 @@ impl AnnotationSet {
for attr in attrs {
if attr.style == syn::AttrStyle::Outer {
if let Some(syn::Meta::NameValue(syn::MetaNameValue { ident, lit: syn::Lit::Str(comment), .. })) =
attr.interpret_meta()
if let Some(syn::Meta::NameValue(syn::MetaNameValue {
ident,
lit: syn::Lit::Str(comment),
..
})) = attr.interpret_meta()
{
let comment = comment.value();
if &*ident.to_string() == "doc" {
......
......@@ -106,45 +106,49 @@ impl Cfg {
&syn::NestedMeta::Meta(syn::Meta::Word(ref ident)) => {
Some(Cfg::Boolean(ident.as_ref().to_owned()))
}
&syn::NestedMeta::Meta(syn::Meta::NameValue(syn::MetaNameValue { ref ident, ref lit, .. })) => {
match lit {
&syn::Lit::Str(ref value) => {
Some(Cfg::Named(ident.as_ref().to_owned(), value.value()))
}
_ => None,
&syn::NestedMeta::Meta(syn::Meta::NameValue(syn::MetaNameValue {
ref ident,
ref lit,
..
})) => match lit {
&syn::Lit::Str(ref value) => {
Some(Cfg::Named(ident.as_ref().to_owned(), value.value()))
}
}
&syn::NestedMeta::Meta(syn::Meta::List(syn::MetaList { ref ident, ref nested, .. })) => {
match ident.as_ref() {
"any" => if let Some(configs) = Cfg::load_list(nested.iter()) {
Some(Cfg::Any(configs))
} else {
None
},
"all" => if let Some(configs) = Cfg::load_list(nested.iter()) {
Some(Cfg::All(configs))
_ => None,
},
&syn::NestedMeta::Meta(syn::Meta::List(syn::MetaList {
ref ident,
ref nested,
..
})) => match ident.as_ref() {
"any" => if let Some(configs) = Cfg::load_list(nested.iter()) {
Some(Cfg::Any(configs))
} else {
None
},
"all" => if let Some(configs) = Cfg::load_list(nested.iter()) {
Some(Cfg::All(configs))
} else {
None
},
"not" => {
if nested.len() != 1 {
return None;
}
if let Some(config) = Cfg::load_single(&nested[0]) {
Some(Cfg::Not(Box::new(config)))
} else {
None
},
"not" => {
if nested.len() != 1 {
return None;
}
if let Some(config) = Cfg::load_single(&nested[0]) {
Some(Cfg::Not(Box::new(config)))
} else {
None
}
}
_ => None,
}
}
_ => None,
},
_ => None,
}
}
fn load_list<'a, I: Iterator<Item=&'a syn::NestedMeta>>(attrs: I) -> Option<Vec<Cfg>> {
fn load_list<'a, I: Iterator<Item = &'a syn::NestedMeta>>(attrs: I) -> Option<Vec<Cfg>> {
let mut configs = Vec::new();
for attr in attrs {
......
......@@ -17,12 +17,22 @@ pub struct LiteralExpr(String);
impl LiteralExpr {
pub fn load(expr: &syn::Expr) -> Result<LiteralExpr, String> {
match expr {
&syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(ref value), .. }) => {
Ok(LiteralExpr(format!("u8\"{}\"", value.value())))
}
&syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Byte(ref value), .. }) => Ok(LiteralExpr(format!("{}", value.value()))),
&syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Char(ref value), .. }) => Ok(LiteralExpr(format!("{}", value.value()))),
&syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Int(ref value), .. }) => match value.suffix() {
&syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Str(ref value),
..
}) => Ok(LiteralExpr(format!("u8\"{}\"", value.value()))),
&syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Byte(ref value),
..
}) => Ok(LiteralExpr(format!("{}", value.value()))),
&syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Char(ref value),
..
}) => Ok(LiteralExpr(format!("{}", value.value()))),
&syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Int(ref value),
..
}) => match value.suffix() {
syn::IntSuffix::Usize
| syn::IntSuffix::U8
| syn::IntSuffix::U16
......@@ -42,10 +52,14 @@ impl LiteralExpr {
)))
},
},
&syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Float(ref value), .. }) => {
Ok(LiteralExpr(format!("{}", value.value())))
}
&syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Bool(ref value), .. }) => Ok(LiteralExpr(format!("{}", value.value))),
&syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Float(ref value),
..
}) => Ok(LiteralExpr(format!("{}", value.value()))),
&syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Bool(ref value),
..
}) => Ok(LiteralExpr(format!("{}", value.value))),
_ => Err("Unsupported literal expression.".to_owned()),
}
}
......
......@@ -26,8 +26,11 @@ impl Documentation {
// step through rust. In that case they are stored as doc
// attributes and the leading three slashes (and optional space)
// are not included.
if let Some(syn::Meta::NameValue(syn::MetaNameValue{ident, lit: syn::Lit::Str(comment), ..})) =
attr.interpret_meta()
if let Some(syn::Meta::NameValue(syn::MetaNameValue {
ident,
lit: syn::Lit::Str(comment),
..
})) = attr.interpret_meta()
{
let name = ident.to_string();
let comment = comment.value();
......
......@@ -30,7 +30,13 @@ impl EnumVariant {
mod_cfg: &Option<Cfg>,
) -> Result<Self, String> {
let discriminant = match &variant.discriminant {
&Some((_, syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Int(ref lit), .. }))) => Some(lit.value()),
&Some((
_,
syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Int(ref lit),
..
}),
)) => Some(lit.value()),
&Some(_) => {
return Err("Unsupported discriminant.".to_owned());
}
......@@ -39,7 +45,7 @@ impl EnumVariant {
fn parse_fields(
is_tagged: bool,
fields: &syn::punctuated::Punctuated<syn::Field, syn::token::Comma>
fields: &syn::punctuated::Punctuated<syn::Field, syn::token::Comma>,
) -> Result<Vec<(String, Type, Documentation)>, String> {
let mut res = Vec::new();
......@@ -72,30 +78,26 @@ impl EnumVariant {
let body = match variant.fields {
syn::Fields::Unit => None,
syn::Fields::Named(ref fields) => {
Some(Struct {
name: format!("{}_Body", variant.ident),
generic_params: GenericParams::default(),
fields: parse_fields(is_tagged, &fields.named)?,
is_tagged,
tuple_struct: false,
cfg: Cfg::append(mod_cfg, Cfg::load(&variant.attrs)),
annotations: AnnotationSet::load(&variant.attrs)?,
documentation: Documentation::none(),
})
}
syn::Fields::Unnamed(ref fields) => {
Some(Struct {
name: format!("{}_Body", variant.ident),
generic_params: GenericParams::default(),
fields: parse_fields(is_tagged, &fields.unnamed)?,
is_tagged,
tuple_struct: true,
cfg: Cfg::append(mod_cfg, Cfg::load(&variant.attrs)),
annotations: AnnotationSet::load(&variant.attrs)?,
documentation: Documentation::none(),
})
}
syn::Fields::Named(ref fields) => Some(Struct {
name: format!("{}_Body", variant.ident),
generic_params: GenericParams::default(),
fields: parse_fields(is_tagged, &fields.named)?,
is_tagged,
tuple_struct: false,
cfg: Cfg::append(mod_cfg, Cfg::load(&variant.attrs)),
annotations: AnnotationSet::load(&variant.attrs)?,
documentation: Documentation::none(),
}),
syn::Fields::Unnamed(ref fields) => Some(Struct {
name: format!("{}_Body", variant.ident),
generic_params: GenericParams::default(),
fields: parse_fields(is_tagged, &fields.unnamed)?,
is_tagged,
tuple_struct: true,
cfg: Cfg::append(mod_cfg, Cfg::load(&variant.attrs)),
annotations: AnnotationSet::load(&variant.attrs)?,
documentation: Documentation::none(),
}),
};
Ok(EnumVariant {
......@@ -142,10 +144,7 @@ pub struct Enum {
}
impl Enum {
pub fn load(
item: &syn::ItemEnum,
mod_cfg: &Option<Cfg>,
) -> Result<Enum, String> {
pub fn load(item: &syn::ItemEnum, mod_cfg: &Option<Cfg>) -> Result<Enum, String> {
let repr = Repr::load(&item.attrs)?;
if repr == Repr::RUST {
return Err("Enum not marked with a valid repr(prim) or repr(C).".to_owned());
......@@ -254,21 +253,16 @@ impl Item for Enum {
if let Some(r) = find_first_some(&rules) {
self.variants = self.variants
.iter()
.map(|variant| {
EnumVariant {
name: r.apply_to_pascal_case(
&variant.name,
IdentifierType::EnumVariant(self),
),
discriminant: variant.discriminant.clone(),
body: variant.body.as_ref().map(|body| {
(
r.apply_to_snake_case(&body.0, IdentifierType::StructMember),
body.1.clone(),
)
}),
documentation: variant.documentation.clone(),
}
.map(|variant| EnumVariant {
name: r.apply_to_pascal_case(&variant.name, IdentifierType::EnumVariant(self)),
discriminant: variant.discriminant.clone(),
body: variant.body.as_ref().map(|body| {
(
r.apply_to_snake_case(&body.0, IdentifierType::StructMember),
body.1.clone(),
)
}),
documentation: variant.documentation.clone(),
})
.collect();
}
......@@ -367,7 +361,11 @@ impl Source for Enum {
out.new_line();
if config.language == Language::C {
write!(out, "typedef {}", if separate_tag { "struct" } else { "union" });
write!(
out,
"typedef {}",
if separate_tag { "struct" } else { "union" }
);
out.open_brace();
}
......
......@@ -7,9 +7,9 @@ use std::io::Write;
use syn;
use bindgen::cdecl;
use bindgen::config::{Config, Layout, Language};
use bindgen::config::{Config, Language, Layout};
use bindgen::dependencies::Dependencies;
use bindgen::ir::{AnnotationSet, Cfg, CfgWrite, Documentation, Type, PrimitiveType};
use bindgen::ir::{AnnotationSet, Cfg, CfgWrite, Documentation, PrimitiveType, Type};
use bindgen::library::Library;
use bindgen::monomorph::Monomorphs;
use bindgen::rename::{IdentifierType, RenameRule};
......@@ -37,9 +37,7 @@ impl Function {
) -> Result<Function, String> {
let args = decl.inputs.iter().try_skip_map(|x| x.as_ident_and_type())?;
let ret = match decl.output {
syn::ReturnType::Default => {
Type::Primitive(PrimitiveType::Void)
}
syn::ReturnType::Default => Type::Primitive(PrimitiveType::Void),
syn::ReturnType::Type(_, ref ty) => {
if let Some(x) = Type::load(ty)? {
x
......@@ -192,7 +190,11 @@ pub trait SynFnArgHelpers {
impl SynFnArgHelpers for syn::FnArg {
fn as_ident_and_type(&self) -> Result<Option<(String, Type)>, String> {
match self {
&syn::FnArg::Captured(syn::ArgCaptured { pat: syn::Pat::Ident(syn::PatIdent { ref ident, .. }), ref ty, .. }) => {
&syn::FnArg::Captured(syn::ArgCaptured {
pat: syn::Pat::Ident(syn::PatIdent { ref ident, .. }),
ref ty,
..
}) => {
if let Some(x) = Type::load(ty)? {
Ok(Some((ident.to_string(), x)))
} else {
......
......@@ -16,7 +16,9 @@ impl GenericParams {
.params
.iter()
.filter_map(|x| match x {
&syn::GenericParam::Type(syn::TypeParam { ref ident, .. }) => Some(ident.to_string()),
&syn::GenericParam::Type(syn::TypeParam { ref ident, .. }) => {
Some(ident.to_string())
}
_ => None,
})
.collect::<Vec<_>>(),
......
......@@ -23,10 +23,7 @@ pub struct Static {
}
impl Static {
pub fn load(
item: &syn::ItemStatic,
mod_cfg: &Option<Cfg>,
) -> Result<Static, String> {
pub fn load(item: &syn::ItemStatic, mod_cfg: &Option<Cfg>) -> Result<Static, String> {
let ty = Type::load(&item.ty)?;
if ty.is_none() {
......
......@@ -78,7 +78,9 @@ impl<T: Item + Clone> ItemMap<T> {
pub fn rebuild(&mut self) {
let old = mem::replace(self, ItemMap::new());
old.for_all_items(|x| { self.try_insert(x.clone()); });
old.for_all_items(|x| {
self.try_insert(x.clone());
});
}
pub fn try_insert(&mut self, item: T) -> bool {
......
......@@ -34,18 +34,17 @@ impl GenericPath {
}
let generics = match &last_segment.arguments {
&syn::PathArguments::AngleBracketed(syn::AngleBracketedGenericArguments { ref args, .. }) => {
args.iter().try_skip_map(|x| {
match *x {
&syn::GenericArgument::Type(ref x) => Type::load(x),
_ => { Err(String::new()) }
}
})?
}
&syn::PathArguments::AngleBracketed(syn::AngleBracketedGenericArguments {
ref args,
..
}) => args.iter().try_skip_map(|x| match *x {
&syn::GenericArgument::Type(ref x) => Type::load(x),
_ => Err(String::new()),
})?,
&syn::PathArguments::Parenthesized(_) => {
return Err("Path contains parentheses.".to_owned());
}
_ => Vec::new()
_ => Vec::new(),
};
Ok(GenericPath::new(name, generics))
......
......@@ -53,7 +53,9 @@ impl Repr {
return None;
}
if let Some(syn::Meta::List(syn::MetaList { ident, nested, .. })) = attr.interpret_meta() {
if let Some(syn::Meta::List(syn::MetaList { ident, nested, .. })) =
attr.interpret_meta()
{
if ident.as_ref() == "repr" {
return Some(nested.into_iter().collect::<Vec<_>>());
}
......
......@@ -30,10 +30,7 @@ pub struct Struct {
}
impl Struct {
pub fn load(
item: &syn::ItemStruct,
mod_cfg: &Option<Cfg>,
) -> Result<Struct, String> {
pub fn load(item: &syn::ItemStruct, mod_cfg: &Option<Cfg>) -> Result<Struct, String> {
if Repr::load(&item.attrs)? != Repr::C {
return Err("Struct is not marked #[repr(C)].".to_owned());
}
......@@ -231,9 +228,7 @@ impl Source for Struct {
if config.language == Language::Cxx {
let mut wrote_start_newline = false;
if config.structure.derive_constructor(&self.annotations)
&& !self.fields.is_empty()
{
if config.structure.derive_constructor(&self.annotations) && !self.fields.is_empty() {
if !wrote_start_newline {
wrote_start_newline = true;
out.new_line();
......@@ -242,7 +237,9 @@ impl Source for Struct {
out.new_line();
let arg_renamer = |name: &str| {
config.function.rename_args
config
.function
.rename_args
.as_ref()
.unwrap_or(&RenameRule::GeckoCase)
.apply_to_snake_case(name, IdentifierType::FunctionArg)
......
......@@ -228,7 +228,11 @@ impl Type {
Type::Path(path)
}
}
&syn::Type::Array(syn::TypeArray { ref elem, len: syn::Expr::Path(ref path), .. }) => {
&syn::Type::Array(syn::TypeArray {
ref elem,
len: syn::Expr::Path(ref path),
..
}) => {
let converted = Type::load(elem)?;
let converted = match converted {
......@@ -240,7 +244,15 @@ impl Type {
Type::Array(Box::new(converted), path.name)
}
&syn::Type::Array(syn::TypeArray { ref elem, len: syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Int(ref len), .. }), .. }) => {
&syn::Type::Array(syn::TypeArray {
ref elem,
len:
syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Int(ref len),
..
}),
..
}) => {
let converted = Type::load(elem)?;
let converted = match converted {
......@@ -253,9 +265,7 @@ impl Type {
&syn::Type::BareFn(ref function) => {
let args = function.inputs.iter().try_skip_map(|x| Type::load(&x.ty))?;
let ret = match function.output {
syn::ReturnType::Default => {
Type::Primitive(PrimitiveType::Void)
}
syn::ReturnType::Default => Type::Primitive(PrimitiveType::Void),
syn::ReturnType::Type(_, ref ty) => {
if let Some(x) = Type::load(ty)? {
x
......
......@@ -28,10 +28,7 @@ pub struct Typedef {
}
impl Typedef {
pub fn load(
item: &syn::ItemType,
mod_cfg: &Option<Cfg>,
) -> Result<Typedef, String> {
pub fn load(item: &syn::ItemType, mod_cfg: &Option<Cfg>) -> Result<Typedef, String> {
if let Some(x) = Type::load(&item.ty)? {
Ok(Typedef {
name: item.ident.to_string(),
......
......@@ -30,16 +30,16 @@ pub struct Union {
}
impl Union {
pub fn load(
item: &syn::ItemUnion,
mod_cfg: &Option<Cfg>,
) -> Result<Union, String> {
pub fn load(item: &syn::ItemUnion, mod_cfg: &Option<Cfg>) -> Result<Union, String> {
if Repr::load(&item.attrs)? != Repr::C {
return Err("Union is not marked #[repr(C)].".to_owned());
}
let (fields, tuple_union) = {
let out = item.fields.named.iter().try_skip_map(|x| x.as_ident_and_type())?;
let out = item.fields
.named
.iter()
.try_skip_map(|x| x.as_ident_and_type())?;
(out, false)
};
......
......@@ -123,14 +123,22 @@ impl Library {
fn remove_excluded(&mut self) {
let config = &self.config;
self.functions.retain(|x| !config.export.exclude.contains(&x.name));
self.enums.filter(|x| config.export.exclude.contains(&x.name));
self.structs.filter(|x| config.export.exclude.contains(&x.name));
self.unions.filter(|x| config.export.exclude.contains(&x.name));