Don't generate extension traits for inextensible structs
This commit is contained in:
parent
fc1625e81c
commit
c0b7d91faf
2 changed files with 1783 additions and 1868 deletions
3636
ash/src/vk.rs
3636
ash/src/vk.rs
File diff suppressed because it is too large
Load diff
|
@ -1542,6 +1542,11 @@ pub fn derive_setters(_struct: &vkxml::Struct) -> Option<Tokens> {
|
||||||
let extends_name = name_to_tokens(&format!("Extends{}", name));
|
let extends_name = name_to_tokens(&format!("Extends{}", name));
|
||||||
if let Some(extends) = &_struct.extends {
|
if let Some(extends) = &_struct.extends {
|
||||||
for target in extends.split(',') {
|
for target in extends.split(',') {
|
||||||
|
let target = match target {
|
||||||
|
// https://github.com/KhronosGroup/Vulkan-Docs/pull/870
|
||||||
|
"VkPhysicalDeviceProperties" => "VkPhysicalDeviceProperties2",
|
||||||
|
x => x,
|
||||||
|
};
|
||||||
let target_ident = name_to_tokens(&format!("Extends{}", name_to_tokens(target)));
|
let target_ident = name_to_tokens(&format!("Extends{}", name_to_tokens(target)));
|
||||||
nexts.push(quote! {
|
nexts.push(quote! {
|
||||||
unsafe impl #target_ident for #name {}
|
unsafe impl #target_ident for #name {}
|
||||||
|
@ -1569,6 +1574,14 @@ pub fn derive_setters(_struct: &vkxml::Struct) -> Option<Tokens> {
|
||||||
quote!{}
|
quote!{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let next_trait = if has_next {
|
||||||
|
quote!{
|
||||||
|
pub unsafe trait #extends_name {}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
quote!{}
|
||||||
|
};
|
||||||
|
|
||||||
let q = quote!{
|
let q = quote!{
|
||||||
impl #name {
|
impl #name {
|
||||||
pub fn builder<'a>() -> #name_builder<'a> {
|
pub fn builder<'a>() -> #name_builder<'a> {
|
||||||
|
@ -1584,7 +1597,7 @@ pub fn derive_setters(_struct: &vkxml::Struct) -> Option<Tokens> {
|
||||||
marker: ::std::marker::PhantomData<&'a ()>,
|
marker: ::std::marker::PhantomData<&'a ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe trait #extends_name {}
|
#next_trait
|
||||||
|
|
||||||
#(#nexts)*
|
#(#nexts)*
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue