pub struct GenConfig<'a> {Show 15 fields
pub remove_type_prefix: bool,
pub remove_vk_result_prefix: bool,
pub remove_command_prefix: bool,
pub remove_bitmask_prefix: bool,
pub remove_const_prefix: bool,
pub variant_padding: VariantPaddingConfig,
pub snake_case_commands: bool,
pub camel_case_variants: bool,
pub snake_case_members: bool,
pub debug_c_strings: bool,
pub use_native_enums: bool,
pub use_native_unions: bool,
pub wrap_bitmasks: bool,
pub use_libc_types: bool,
pub extern_type_overrides: &'a [(&'a str, &'a str)],
}Expand description
Configuration options fot the Vulkan generator.
Fields§
§remove_type_prefix: boolWhether or not to remove the Vk prefix on structs, enums, and typedefs.
As an example, take the struct VkInstanceCreateInfo. If this is set to true, the generator
will turn that into InstanceCreateInfo.
Defaults to false.
remove_vk_result_prefix: boolWhether or not to remove the Vk prefix from the VkResult enum, IF AND ONLY IF
remove_type_prefix is also set to true. This flag exists primarily because Rust already
contains a type named Result and one might desire to remove any ambiguity the VkResult type
may cause.
Defaults to true.
remove_command_prefix: boolWhether or not to remove the vk prefix from Vulkan commands.
For example, if we have the command vkCreateInstance setting this flag to true will turn
that into createInstance.
Defaults to true.
remove_bitmask_prefix: boolWhether or not to remove the VK_ prefix from bitmask variants.
For example, the xml registry defines the bitmask VkQueueFlagBits with the flag
VK_QUEUE_GRAPHICS_BIT. If this is true, this will result in the variant being turned into
QUEUE_GRAPHICS_BIT.
Defaults to true.
remove_const_prefix: boolWhether or not to remove the VK_ prefix from constant names.
For example, the xml registry defines the constant VK_MAX_EXTENSION_NAME_SIZE.
If this is true, this will result in the constant being turned into
MAX_EXTENSION_NAME_SIZE.
Defaults to true.
variant_padding: VariantPaddingConfigHow to handle enum variants, see VariantPaddingConfig for details.
Defaults to VariantPaddingConfig::Strip.
snake_case_commands: boolWhether or not to transform Vulkan command identifiers to be a Rust-y snake_case.
For example, the registry defines the command vkCreateInstance. If this is true, that
command will be turned into vk_create_instance. This, and the other name-style-altering
options, primarily exists for the purpose of having Vulkan code integrate more cleanly into
native Rust code.
Defaults to true.
camel_case_variants: boolWhether or not to transform enum variants into CamelCase.
For example, if we look at VkStructureType’s VK_STRUCTURE_TYPE_APPLICATION_INFO setting
this to true would result in the variant being turned into VkStructureTypeApplicationInfo.
Defaults to true.
snake_case_members: boolWhether or not to transform struct/union members and command parameters into snake_case.
For example, if we look at the VkApplicationInfo struct’s applicationVersion field, setting
this to true would result in the field being turned into application_version.
Defaults to true.
debug_c_strings: boolWhen printing structs with fields that are arrays of c_chars, whether to print them as arrays of bytes or as a string.
Defaults to true.
use_native_enums: boolWhether or not to use the enum keyword to create native tagged unions.
Defaults to true.
use_native_unions: boolWhether or not to use the unstable union keyword to create native untagged unions.
Currently relies on the untagged_unions feature.
Defaults to false.
wrap_bitmasks: boolWhether or not to wrap bitmasks with a set of convenience functions similar to the bitflags crate.
Defaults to true.
use_libc_types: boolThe Vulkan library uses a lot of C types, as per it’s nature of exposing a C ABI. There are
a few ways we can handle using those types: either we can define the typedefs ourself or we can
use the types provided by libc. Because libc isn’t implicitly included in crates we default
to defining the types ourself. Setting this to true makes the generated file import types
from libc instead of defining them itself.
extern_type_overrides: &'a [(&'a str, &'a str)]This defines a set of type overrides, primarily intended for use with the WSI extensions. It takes a slice of (&str, &str) tuples, with the left side being the name of the type and the right side being the new definition of the type.
For an example let’s look at the Windows WSI extension, which includes the struct
VkWin32SurfaceCreateInfoKHR. That struct takes a HWND and a HINSTANCE in order to let Vulkan
draw to windows; however, the generator is unaware of both HWND and HINSTANCE, which are
defined in winapi. Because it has no idea what those types should be the generator defaults
to type HWND = *const (), which isn’t what HWNDs are defined as in winapi. So we call this:
let config = GenConfig {
extern_type_overrides: &[
("HWND", "winapi::HWND"),
("HINSTANCE", "winapi::HINSTANCE")
],
..GenConfig::default()
};This tells the generator to use the winapi defintions of HWND instead of the blind
definition, making the generator produce these for the type defintions:
type HWND = winapi::HWND;
type HINSTANCE = winapi::HINSTANCE;Implementations§
Trait Implementations§
impl<'a> Copy for GenConfig<'a>
impl<'a> Eq for GenConfig<'a>
impl<'a> StructuralPartialEq for GenConfig<'a>
Auto Trait Implementations§
impl<'a> Freeze for GenConfig<'a>
impl<'a> RefUnwindSafe for GenConfig<'a>
impl<'a> Send for GenConfig<'a>
impl<'a> Sync for GenConfig<'a>
impl<'a> Unpin for GenConfig<'a>
impl<'a> UnwindSafe for GenConfig<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)