Iterator simplification (#565)
* Unnest iterators This hopefully makes the iterator definitions better resemble paths into the XML tree. * Use for-loop instead of .for_each() * Use elems.contains(x) instead of elems.iter().any(...) * Shrink commands-related .fold() Co-authored-by: Steve Wooster <s.f.m.wooster@gmail.com>
This commit is contained in:
parent
b16bb4e62c
commit
3c7615b3bb
|
@ -18,6 +18,21 @@ use std::fmt::Display;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use syn::Ident;
|
use syn::Ident;
|
||||||
|
|
||||||
|
macro_rules! get_variant {
|
||||||
|
($variant:path) => {
|
||||||
|
|enum_| match enum_ {
|
||||||
|
$variant(inner) => Some(inner),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
($variant:path { $($member:ident),+ }) => {
|
||||||
|
|enum_| match enum_ {
|
||||||
|
$variant { $($member),+, .. } => Some(( $($member),+ )),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const BACKWARDS_COMPATIBLE_ALIAS_COMMENT: &str = "Backwards-compatible alias containing a typo";
|
const BACKWARDS_COMPATIBLE_ALIAS_COMMENT: &str = "Backwards-compatible alias containing a typo";
|
||||||
|
|
||||||
pub trait ExtensionExt {}
|
pub trait ExtensionExt {}
|
||||||
|
@ -912,10 +927,7 @@ pub fn generate_extension_constants<'a>(
|
||||||
) -> TokenStream {
|
) -> TokenStream {
|
||||||
let items = extension_items
|
let items = extension_items
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|item| match item {
|
.filter_map(get_variant!(vk_parse::ExtensionChild::Require { items }))
|
||||||
vk_parse::ExtensionChild::Require { items, .. } => Some(items.iter()),
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.flatten();
|
.flatten();
|
||||||
|
|
||||||
let mut extended_enums = BTreeMap::<String, Vec<ExtensionConstant>>::new();
|
let mut extended_enums = BTreeMap::<String, Vec<ExtensionConstant>>::new();
|
||||||
|
@ -984,29 +996,22 @@ pub fn generate_extension_commands<'a>(
|
||||||
) -> TokenStream {
|
) -> TokenStream {
|
||||||
let mut commands = Vec::new();
|
let mut commands = Vec::new();
|
||||||
let mut aliases = HashMap::new();
|
let mut aliases = HashMap::new();
|
||||||
items
|
let names = items
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|ext_item| match ext_item {
|
.filter_map(get_variant!(vk_parse::ExtensionChild::Require { items }))
|
||||||
vk_parse::ExtensionChild::Require { items, .. } => {
|
|
||||||
Some(items.iter().filter_map(|item| match item {
|
|
||||||
vk_parse::InterfaceItem::Command { ref name, .. } => Some(name),
|
|
||||||
_ => None,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.flatten()
|
.flatten()
|
||||||
.for_each(|name| {
|
.filter_map(get_variant!(vk_parse::InterfaceItem::Command { name }));
|
||||||
if let Some(cmd) = cmd_map.get(name).copied() {
|
for name in names {
|
||||||
commands.push(cmd);
|
if let Some(cmd) = cmd_map.get(name).copied() {
|
||||||
} else if let Some(cmd) = cmd_aliases
|
commands.push(cmd);
|
||||||
.get(name)
|
} else if let Some(cmd) = cmd_aliases
|
||||||
.and_then(|alias_name| cmd_map.get(alias_name).copied())
|
.get(name)
|
||||||
{
|
.and_then(|alias_name| cmd_map.get(alias_name).copied())
|
||||||
aliases.insert(cmd.name.clone(), name.to_string());
|
{
|
||||||
commands.push(cmd);
|
aliases.insert(cmd.name.clone(), name.to_string());
|
||||||
}
|
commands.push(cmd);
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let ident = format_ident!(
|
let ident = format_ident!(
|
||||||
"{}Fn",
|
"{}Fn",
|
||||||
|
@ -1016,17 +1021,10 @@ pub fn generate_extension_commands<'a>(
|
||||||
|
|
||||||
let spec_version = items
|
let spec_version = items
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|ext_item| match ext_item {
|
.filter_map(get_variant!(vk_parse::ExtensionChild::Require { items }))
|
||||||
vk_parse::ExtensionChild::Require { items, .. } => {
|
.flatten()
|
||||||
items.iter().find_map(|item| match item {
|
.filter_map(get_variant!(vk_parse::InterfaceItem::Enum))
|
||||||
vk_parse::InterfaceItem::Enum(ref e) if e.name.contains("SPEC_VERSION") => {
|
.find(|e| e.name.contains("SPEC_VERSION"))
|
||||||
Some(e)
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.and_then(|e| {
|
.and_then(|e| {
|
||||||
if let vk_parse::EnumSpec::Value { value, .. } = &e.spec {
|
if let vk_parse::EnumSpec::Value { value, .. } = &e.spec {
|
||||||
let v: u32 = str::parse(value).unwrap();
|
let v: u32 = str::parse(value).unwrap();
|
||||||
|
@ -1283,10 +1281,7 @@ pub fn generate_enum<'a>(
|
||||||
let constants = enum_
|
let constants = enum_
|
||||||
.children
|
.children
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|elem| match *elem {
|
.filter_map(get_variant!(vk_parse::EnumsChild::Enum))
|
||||||
vk_parse::EnumsChild::Enum(ref constant) => Some(constant),
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.filter(|constant| constant.notation() != Some(BACKWARDS_COMPATIBLE_ALIAS_COMMENT))
|
.filter(|constant| constant.notation() != Some(BACKWARDS_COMPATIBLE_ALIAS_COMMENT))
|
||||||
.collect_vec();
|
.collect_vec();
|
||||||
|
|
||||||
|
@ -1407,10 +1402,10 @@ fn is_static_array(field: &vkxml::Field) -> bool {
|
||||||
}
|
}
|
||||||
pub fn derive_default(_struct: &vkxml::Struct) -> Option<TokenStream> {
|
pub fn derive_default(_struct: &vkxml::Struct) -> Option<TokenStream> {
|
||||||
let name = name_to_tokens(&_struct.name);
|
let name = name_to_tokens(&_struct.name);
|
||||||
let members = _struct.elements.iter().filter_map(|elem| match *elem {
|
let members = _struct
|
||||||
vkxml::StructElement::Member(ref field) => Some(field),
|
.elements
|
||||||
_ => None,
|
.iter()
|
||||||
});
|
.filter_map(get_variant!(vkxml::StructElement::Member));
|
||||||
let is_structure_type = |field: &vkxml::Field| field.basetype == "VkStructureType";
|
let is_structure_type = |field: &vkxml::Field| field.basetype == "VkStructureType";
|
||||||
|
|
||||||
// This are also pointers, and therefor also don't implement Default. The spec
|
// This are also pointers, and therefor also don't implement Default. The spec
|
||||||
|
@ -1472,10 +1467,10 @@ pub fn derive_default(_struct: &vkxml::Struct) -> Option<TokenStream> {
|
||||||
}
|
}
|
||||||
pub fn derive_debug(_struct: &vkxml::Struct, union_types: &HashSet<&str>) -> Option<TokenStream> {
|
pub fn derive_debug(_struct: &vkxml::Struct, union_types: &HashSet<&str>) -> Option<TokenStream> {
|
||||||
let name = name_to_tokens(&_struct.name);
|
let name = name_to_tokens(&_struct.name);
|
||||||
let members = _struct.elements.iter().filter_map(|elem| match *elem {
|
let members = _struct
|
||||||
vkxml::StructElement::Member(ref field) => Some(field),
|
.elements
|
||||||
_ => None,
|
.iter()
|
||||||
});
|
.filter_map(get_variant!(vkxml::StructElement::Member));
|
||||||
let contains_pfn = members.clone().any(|field| {
|
let contains_pfn = members.clone().any(|field| {
|
||||||
field
|
field
|
||||||
.name
|
.name
|
||||||
|
@ -1545,19 +1540,19 @@ pub fn derive_setters(
|
||||||
let name = name_to_tokens(&struct_.name);
|
let name = name_to_tokens(&struct_.name);
|
||||||
let name_builder = name_to_tokens(&(struct_.name.clone() + "Builder"));
|
let name_builder = name_to_tokens(&(struct_.name.clone() + "Builder"));
|
||||||
|
|
||||||
let members = struct_.elements.iter().filter_map(|elem| match *elem {
|
let members = struct_
|
||||||
vkxml::StructElement::Member(ref field) => Some(field),
|
.elements
|
||||||
_ => None,
|
.iter()
|
||||||
});
|
.filter_map(get_variant!(vkxml::StructElement::Member));
|
||||||
|
|
||||||
let next_field = members
|
let next_field = members
|
||||||
.clone()
|
.clone()
|
||||||
.find(|field| field.param_ident() == "p_next");
|
.find(|field| field.param_ident() == "p_next");
|
||||||
|
|
||||||
let nofilter_count_members = [
|
let nofilter_count_members = [
|
||||||
"VkPipelineViewportStateCreateInfo.pViewports",
|
("VkPipelineViewportStateCreateInfo", "pViewports"),
|
||||||
"VkPipelineViewportStateCreateInfo.pScissors",
|
("VkPipelineViewportStateCreateInfo", "pScissors"),
|
||||||
"VkDescriptorSetLayoutBinding.pImmutableSamplers",
|
("VkDescriptorSetLayoutBinding", "pImmutableSamplers"),
|
||||||
];
|
];
|
||||||
let filter_members: Vec<String> = members
|
let filter_members: Vec<String> = members
|
||||||
.clone()
|
.clone()
|
||||||
|
@ -1567,10 +1562,7 @@ pub fn derive_setters(
|
||||||
// Associated _count members
|
// Associated _count members
|
||||||
if field.array.is_some() {
|
if field.array.is_some() {
|
||||||
if let Some(ref array_size) = field.size {
|
if let Some(ref array_size) = field.size {
|
||||||
if !nofilter_count_members
|
if !nofilter_count_members.contains(&(&struct_.name, field_name)) {
|
||||||
.iter()
|
|
||||||
.any(|&n| n == (struct_.name.clone() + "." + field_name))
|
|
||||||
{
|
|
||||||
return Some((*array_size).clone());
|
return Some((*array_size).clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1935,10 +1927,10 @@ pub fn generate_struct(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let members = _struct.elements.iter().filter_map(|elem| match *elem {
|
let members = _struct
|
||||||
vkxml::StructElement::Member(ref field) => Some(field),
|
.elements
|
||||||
_ => None,
|
.iter()
|
||||||
});
|
.filter_map(get_variant!(vkxml::StructElement::Member));
|
||||||
|
|
||||||
let params = members.clone().map(|field| {
|
let params = members.clone().map(|field| {
|
||||||
let param_ident = field.param_ident();
|
let param_ident = field.param_ident();
|
||||||
|
@ -2101,42 +2093,21 @@ pub fn generate_feature<'a>(
|
||||||
let (static_commands, entry_commands, device_commands, instance_commands) = feature
|
let (static_commands, entry_commands, device_commands, instance_commands) = feature
|
||||||
.elements
|
.elements
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|feature| {
|
.filter_map(get_variant!(vkxml::FeatureElement::Require))
|
||||||
if let vkxml::FeatureElement::Require(ref spec) = feature {
|
.flat_map(|spec| &spec.elements)
|
||||||
spec.elements
|
.filter_map(get_variant!(vkxml::FeatureReference::CommandReference))
|
||||||
.iter()
|
|
||||||
.filter_map(|feature_spec| {
|
|
||||||
if let vkxml::FeatureReference::CommandReference(ref cmd_ref) = feature_spec
|
|
||||||
{
|
|
||||||
Some(cmd_ref)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
} else {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.filter_map(|cmd_ref| commands.get(&cmd_ref.name))
|
.filter_map(|cmd_ref| commands.get(&cmd_ref.name))
|
||||||
.fold(
|
.fold(
|
||||||
(Vec::new(), Vec::new(), Vec::new(), Vec::new()),
|
(Vec::new(), Vec::new(), Vec::new(), Vec::new()),
|
||||||
|mut acc, &cmd_ref| {
|
|mut accs, &cmd_ref| {
|
||||||
match cmd_ref.function_type() {
|
let acc = match cmd_ref.function_type() {
|
||||||
FunctionType::Static => {
|
FunctionType::Static => &mut accs.0,
|
||||||
acc.0.push(cmd_ref);
|
FunctionType::Entry => &mut accs.1,
|
||||||
}
|
FunctionType::Device => &mut accs.2,
|
||||||
FunctionType::Entry => {
|
FunctionType::Instance => &mut accs.3,
|
||||||
acc.1.push(cmd_ref);
|
};
|
||||||
}
|
acc.push(cmd_ref);
|
||||||
FunctionType::Device => {
|
accs
|
||||||
acc.2.push(cmd_ref);
|
|
||||||
}
|
|
||||||
FunctionType::Instance => {
|
|
||||||
acc.3.push(cmd_ref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
acc
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
let version = feature.version_string();
|
let version = feature.version_string();
|
||||||
|
@ -2206,16 +2177,19 @@ pub fn generate_feature_extension<'a>(
|
||||||
const_cache: &mut HashSet<&'a str>,
|
const_cache: &mut HashSet<&'a str>,
|
||||||
const_values: &mut BTreeMap<Ident, ConstantTypeInfo>,
|
const_values: &mut BTreeMap<Ident, ConstantTypeInfo>,
|
||||||
) -> TokenStream {
|
) -> TokenStream {
|
||||||
let constants = registry.0.iter().filter_map(|item| match item {
|
let constants = registry
|
||||||
vk_parse::RegistryChild::Feature(feature) => Some(generate_extension_constants(
|
.0
|
||||||
&feature.name,
|
.iter()
|
||||||
0,
|
.filter_map(get_variant!(vk_parse::RegistryChild::Feature))
|
||||||
&feature.children,
|
.map(|feature| {
|
||||||
const_cache,
|
generate_extension_constants(
|
||||||
const_values,
|
&feature.name,
|
||||||
)),
|
0,
|
||||||
_ => None,
|
&feature.children,
|
||||||
});
|
const_cache,
|
||||||
|
const_values,
|
||||||
|
)
|
||||||
|
});
|
||||||
quote! {
|
quote! {
|
||||||
#(#constants)*
|
#(#constants)*
|
||||||
}
|
}
|
||||||
|
@ -2317,16 +2291,9 @@ pub fn extract_native_types(registry: &vk_parse::Registry) -> (Vec<(String, Stri
|
||||||
let types = registry
|
let types = registry
|
||||||
.0
|
.0
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|item| match item {
|
.filter_map(get_variant!(vk_parse::RegistryChild::Types))
|
||||||
vk_parse::RegistryChild::Types(ref ty) => {
|
.flat_map(|ty| &ty.children)
|
||||||
Some(ty.children.iter().filter_map(|child| match child {
|
.filter_map(get_variant!(vk_parse::TypesChild::Type));
|
||||||
vk_parse::TypesChild::Type(ty) => Some(ty),
|
|
||||||
_ => None,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.flatten();
|
|
||||||
|
|
||||||
for ty in types {
|
for ty in types {
|
||||||
match ty.category.as_deref() {
|
match ty.category.as_deref() {
|
||||||
|
@ -2372,11 +2339,10 @@ pub fn generate_aliases_of_types(
|
||||||
let aliases = types
|
let aliases = types
|
||||||
.children
|
.children
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|child| match child {
|
.filter_map(get_variant!(vk_parse::TypesChild::Type))
|
||||||
vk_parse::TypesChild::Type(ty) => Some((ty.name.as_ref()?, ty.alias.as_ref()?)),
|
.filter_map(|ty| {
|
||||||
_ => None,
|
let name = ty.name.as_ref()?;
|
||||||
})
|
let alias = ty.alias.as_ref()?;
|
||||||
.filter_map(|(name, alias)| {
|
|
||||||
let name_ident = name_to_tokens(name);
|
let name_ident = name_to_tokens(name);
|
||||||
if !ty_cache.insert(name_ident.clone()) {
|
if !ty_cache.insert(name_ident.clone()) {
|
||||||
return None;
|
return None;
|
||||||
|
@ -2399,80 +2365,54 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
|
||||||
let extensions: &Vec<vk_parse::Extension> = spec2
|
let extensions: &Vec<vk_parse::Extension> = spec2
|
||||||
.0
|
.0
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|item| match item {
|
.find_map(get_variant!(vk_parse::RegistryChild::Extensions))
|
||||||
vk_parse::RegistryChild::Extensions(ref ext) => Some(&ext.children),
|
.map(|ext| &ext.children)
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.expect("extension");
|
.expect("extension");
|
||||||
let mut ty_cache = HashSet::new();
|
let mut ty_cache = HashSet::new();
|
||||||
let aliases: Vec<_> = spec2
|
let aliases: Vec<_> = spec2
|
||||||
.0
|
.0
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|item| match item {
|
.filter_map(get_variant!(vk_parse::RegistryChild::Types))
|
||||||
vk_parse::RegistryChild::Types(ref ty) => {
|
.map(|ty| generate_aliases_of_types(ty, &mut ty_cache))
|
||||||
Some(generate_aliases_of_types(ty, &mut ty_cache))
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let spec = vk_parse::parse_file_as_vkxml(&vk_xml).expect("Invalid xml file.");
|
let spec = vk_parse::parse_file_as_vkxml(&vk_xml).expect("Invalid xml file.");
|
||||||
let cmd_aliases: HashMap<String, String> = spec2
|
let cmd_aliases: HashMap<String, String> = spec2
|
||||||
.0
|
.0
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|item| match item {
|
.filter_map(get_variant!(vk_parse::RegistryChild::Commands))
|
||||||
vk_parse::RegistryChild::Commands(cmds) => {
|
.flat_map(|cmds| &cmds.children)
|
||||||
let cmd_tuple_iter = cmds.children.iter().filter_map(|cmd| match cmd {
|
.filter_map(get_variant!(vk_parse::Command::Alias { name, alias }))
|
||||||
vk_parse::Command::Alias { name, alias } => {
|
.map(|(name, alias)| (name.to_string(), alias.to_string()))
|
||||||
Some((name.to_string(), alias.to_string()))
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
});
|
|
||||||
Some(cmd_tuple_iter)
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let commands: HashMap<vkxml::Identifier, &vkxml::Command> = spec
|
let commands: HashMap<vkxml::Identifier, &vkxml::Command> = spec
|
||||||
.elements
|
.elements
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|elem| match elem {
|
.filter_map(get_variant!(vkxml::RegistryElement::Commands))
|
||||||
vkxml::RegistryElement::Commands(ref cmds) => Some(cmds),
|
.flat_map(|cmds| &cmds.elements)
|
||||||
_ => None,
|
.map(|cmd| (cmd.name.clone(), cmd))
|
||||||
})
|
|
||||||
.flat_map(|cmds| cmds.elements.iter().map(|cmd| (cmd.name.clone(), cmd)))
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let features: Vec<&vkxml::Feature> = spec
|
let features: Vec<&vkxml::Feature> = spec
|
||||||
.elements
|
.elements
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|elem| match elem {
|
.filter_map(get_variant!(vkxml::RegistryElement::Features))
|
||||||
vkxml::RegistryElement::Features(ref features) => Some(features),
|
.flat_map(|features| &features.elements)
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.flat_map(|features| features.elements.iter())
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let definitions: Vec<&vkxml::DefinitionsElement> = spec
|
let definitions: Vec<&vkxml::DefinitionsElement> = spec
|
||||||
.elements
|
.elements
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|elem| match elem {
|
.filter_map(get_variant!(vkxml::RegistryElement::Definitions))
|
||||||
vkxml::RegistryElement::Definitions(ref definitions) => Some(definitions),
|
.flat_map(|definitions| &definitions.elements)
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.flat_map(|definitions| definitions.elements.iter())
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let constants: Vec<&vkxml::Constant> = spec
|
let constants: Vec<&vkxml::Constant> = spec
|
||||||
.elements
|
.elements
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|elem| match elem {
|
.filter_map(get_variant!(vkxml::RegistryElement::Constants))
|
||||||
vkxml::RegistryElement::Constants(ref constants) => Some(constants),
|
.flat_map(|constants| &constants.elements)
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.flat_map(|constants| constants.elements.iter())
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut fn_cache = HashSet::new();
|
let mut fn_cache = HashSet::new();
|
||||||
|
@ -2484,10 +2424,8 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
|
||||||
let (enum_code, bitflags_code) = spec2
|
let (enum_code, bitflags_code) = spec2
|
||||||
.0
|
.0
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|item| match item {
|
.filter_map(get_variant!(vk_parse::RegistryChild::Enums))
|
||||||
vk_parse::RegistryChild::Enums(ref enums) if enums.kind.is_some() => Some(enums),
|
.filter(|enums| enums.kind.is_some())
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.map(|e| generate_enum(e, &mut const_cache, &mut const_values, &mut bitflags_cache))
|
.map(|e| generate_enum(e, &mut const_cache, &mut const_values, &mut bitflags_cache))
|
||||||
.fold((Vec::new(), Vec::new()), |mut acc, elem| {
|
.fold((Vec::new(), Vec::new()), |mut acc, elem| {
|
||||||
match elem {
|
match elem {
|
||||||
|
@ -2520,10 +2458,8 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
|
||||||
|
|
||||||
let union_types = definitions
|
let union_types = definitions
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|def| match def {
|
.filter_map(get_variant!(vkxml::DefinitionsElement::Union))
|
||||||
vkxml::DefinitionsElement::Union(ref union) => Some(union.name.as_str()),
|
.map(|union_| union_.name.as_str())
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.collect::<HashSet<&str>>();
|
.collect::<HashSet<&str>>();
|
||||||
|
|
||||||
let mut identifier_renames = BTreeMap::new();
|
let mut identifier_renames = BTreeMap::new();
|
||||||
|
|
Loading…
Reference in a new issue