vdf-reader

Crates.iovdf-reader
lib.rsvdf-reader
version
sourcesrc
created_at2023-12-21 19:41:36.717891+00
updated_at2025-03-01 15:36:46.31733+00
descriptionRust parser for valve vdf files.
homepage
repositoryhttps://github.com/icewind1991/vdf-reader
max_upload_size
id1077344
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Robin Appelman (icewind1991)

documentation

README

vdf-reader

A parser for Valve's Data Format v1 (VDF) also known as KeyValues.

The parser focuses on being able to deal with all the various weird forms vdf takes in the wild and providing access to the data stream instead of always requiring parsing the file in full.

Serde

This crate implements a deserializer for serde, but because VDF doesn't map that well only the serde data model not every type might deserialize properly.

Limitations

  • Because the boolean values 0 and 1 can't be distinguished from numbers, it is not possible to use booleans in untagged enums.

  • When deserializing arrays by settings the same key multiple times, the keys have to be consecutive.

    key: 1
    key: 2
    other: 3
    

    will work, but

    key: 1
    other: 3
    key: 2
    

    will not.

Tagged enum root

To help deserialize some common vdf formats, you can use a tagged enum as the root element instead of a struct.

"Variant1" {
    content 1
}

or

"Variant2" {
    other foo
}

can be deserialized into a

enum Data {
    Variant1 {
        content: bool,
    },
    Variant2 {
        other: String,
    }
}
Commit count: 43

cargo fmt