ash icon indicating copy to clipboard operation
ash copied to clipboard

Add `into_builder` next to `builder` method

Open Rua opened this issue 4 years ago • 1 comments

In my code, I set the non-pointer members of Vulkan structs using the struct notation directly, before setting the pointers at the end. Because of the safety advantages, I would like to set pointers using the builder, but I find it unnecessary to set everything else using the builder as well. So I propose adding a method into_builder alongside the existing builder method, that unlike the latter takes self by value and uses it as a basis for creating the new builder. Using this, I could create a struct by directly setting members, convert it into a builder, and use that to set the pointer members. If you think it's appropriate, the into_builder method could set any pointer members to null explicitly so that the lifetimes are correct.

Rua avatar Oct 07 '21 13:10 Rua

See also #441.

MarijnS95 avatar Oct 07 '21 16:10 MarijnS95

The builders are now gone and the builder helper functions are now implemented directly on the Vulkan structs since #602, so this should work OOTB now :tada:

MarijnS95 avatar May 01 '23 21:05 MarijnS95