Crates.io | vk-parse |
lib.rs | vk-parse |
version | 0.13.0 |
source | src |
created_at | 2018-08-03 17:36:55.546786 |
updated_at | 2024-06-01 12:25:04.742057 |
description | Vulkan specification parser |
homepage | |
repository | https://github.com/krolli/vk-parse |
max_upload_size | |
id | 77371 |
size | 164,424 |
vk-parse
is a Rust crate which parses the Vulkan API registry XML and converts it to a Rust representation.
This crate provides a library which parses the Vulkan registry XML and either provides its own lossless representation of the registry, or converts it to structures from vkxml.
To get started, you'll need vk.xml
file which is used for generating Vulkan header files and is stored in Vulkan-Docs repository.
After that, in your Rust project:
Cargo.toml
[dependencies]
vk-parse = "0.13"
main.rs
extern crate vk_parse;
use std::path::Path;
fn main() {
let (registry, _errors) = vk_parse::parse_file(Path::new("vk.xml")).unwrap();
println!("{:?}", registry);
}
Conversion to structures from vkxml is optional and must be enabled using feature.
Cargo.toml
[dependencies]
vk-parse = { version = "0.13", features = ["vkxml-convert"] }
vkxml = "0.3"
main.rs
extern crate vk_parse;
extern crate vkxml;
use std::path::Path;
fn main() {
// You can either parse normal structures and convert them into vkxml format ...
let (registry_ir, _errors) = vk_parse::parse_file(Path::new("vk.xml")).unwrap();
println!("{:?}", registry_ir);
let registry_vkxml: vkxml::Registry = registry_ir.into();
println!("{:?}", registry_vkxml);
// ... or do both in single call.
let registry_vkxml = vk_parse::parse_file_as_vkxml(Path::new("vk.xml")).unwrap();
println!("{:?}", registry_vkxml);
}
This software is dual-licensed under Apache-2.0/MIT, same as Rust itself.