ash-rs / ash

Vulkan bindings for Rust
Apache License 2.0
1.76k stars 186 forks source link

Extension structs have lifetimes even when they don't need one #906

Open Rua opened 3 months ago

Rua commented 3 months ago

Extension structs do contain pointers, but their lifetime cannot ever be used if the only pointer they contain is p_next. Structs like this don't actually borrow anything, all structures in a p_next chain are borrowed by the parent. They have no push_next method, and there are no other methods that return Self with a different lifetime than the input struct. Technically you can set the lifetime using the PhantomData member, but that seems a bit silly and pointless.

Take ExternalMemoryImageCreateInfo for example. It has no methods that borrow data.