11 breaking releases

Uses old Rust 2015

0.12.0 Jun 11, 2023
0.10.0 Feb 19, 2023
0.9.0 Dec 6, 2022
0.8.0 Sep 13, 2022
0.2.0 Sep 10, 2018

#1150 in Parser implementations

Download history 2309/week @ 2023-12-11 2510/week @ 2023-12-18 1790/week @ 2023-12-25 2226/week @ 2024-01-01 2743/week @ 2024-01-08 3069/week @ 2024-01-15 3575/week @ 2024-01-22 2710/week @ 2024-01-29 2951/week @ 2024-02-05 2740/week @ 2024-02-12 2920/week @ 2024-02-19 4364/week @ 2024-02-26 5110/week @ 2024-03-04 5045/week @ 2024-03-11 4716/week @ 2024-03-18 4482/week @ 2024-03-25

20,118 downloads per month
Used in 55 crates (via vulkano)

Apache-2.0/MIT

165KB
4.5K SLoC

vk-parse

LICENSE LICENSE Documentation Crates.io Version Build Status

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.

Usage

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.12"

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.12", 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);
}

License

This software is dual-licensed under Apache-2.0/MIT, same as Rust itself.

Dependencies

~245–435KB