Skip to content

Commit

Permalink
generator: setter: Interpret all references as ptr, not just p_/pp_
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Nov 23, 2020
1 parent 896d577 commit 1dc8b49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions ash/src/vk/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10527,8 +10527,11 @@ impl<'a> DisplayPropertiesKHRBuilder<'a> {
self.inner.display = display;
self
}
pub fn display_name(mut self, display_name: *const c_char) -> DisplayPropertiesKHRBuilder<'a> {
self.inner.display_name = display_name;
pub fn display_name(
mut self,
display_name: &'a ::std::ffi::CStr,
) -> DisplayPropertiesKHRBuilder<'a> {
self.inner.display_name = display_name.as_ptr();
self
}
pub fn physical_dimensions(
Expand Down Expand Up @@ -26270,7 +26273,7 @@ impl<'a> ::std::ops::DerefMut for NativeBufferANDROIDBuilder<'a> {
}
}
impl<'a> NativeBufferANDROIDBuilder<'a> {
pub fn handle(mut self, handle: *const c_void) -> NativeBufferANDROIDBuilder<'a> {
pub fn handle(mut self, handle: &'a c_void) -> NativeBufferANDROIDBuilder<'a> {
self.inner.handle = handle;
self
}
Expand Down Expand Up @@ -44090,9 +44093,9 @@ impl<'a> ::std::ops::DerefMut for AccelerationStructureVersionKHRBuilder<'a> {
impl<'a> AccelerationStructureVersionKHRBuilder<'a> {
pub fn version_data(
mut self,
version_data: *const u8,
version_data: &'a [u8; 2 * UUID_SIZE],
) -> AccelerationStructureVersionKHRBuilder<'a> {
self.inner.version_data = version_data;
self.inner.version_data = version_data.as_ptr();
self
}
#[doc = r" Prepends the given extension struct between the root and the first pointer. This"]
Expand Down
2 changes: 1 addition & 1 deletion generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ pub fn derive_setters(
}

// TODO: Improve in future when https://github.com/rust-lang/rust/issues/53667 is merged id:6
if param_ident_string.starts_with("p_") || param_ident_string.starts_with("pp_") {
if field.reference.is_some() {
if field.basetype == "char" && matches!(field.reference, Some(vkxml::ReferenceType::Pointer)) {
assert!(field.null_terminate);
assert_eq!(field.size, None);
Expand Down

0 comments on commit 1dc8b49

Please sign in to comment.