[][src]Crate byml

A simple to use library for reading, writing, and converting Nintendo binary YAML (BYML) files in Rust. Supports BYML versions 2-4, (v2 used in The Legend of Zelda: Breath of the Wild). Can convert from BYML to readable, editable YAML and back.

Sample usage:

use byml::Byml;
// First grab the file bytes. Yaz0 compressed files are automatically decompressed.
let bytes: Vec<u8> = std::fs::read("test/ActorInfo.product.byml").unwrap();
// Parse the data as a Byml document
let actor_info: Byml = Byml::from_binary(&bytes).unwrap();
// Index BYML hashes and arrays naturally
let actor_list: &Vec<Byml> = actor_info["Actors"].as_array().unwrap();
// 7934 actors, egads!
assert_eq!(actor_list.len(), 7934);
// Hmm, we'll iterate the actors listed in this file:
for actor in actor_list.iter() {
    // Print each actor's name
    println!("{}", actor["name"].as_string().unwrap());
}
// Dump to YAML
std::fs::write("test/ActorInfo.yml", actor_info.to_text().unwrap()).unwrap();

Structs

Double

Wrapper type to preserve f64 values with Eq and related traits. Implements From<f64> and Into<f64>.

Float

Wrapper type to preserve f32 values with Eq and related traits. Implements From<f32> and Into<f32>.

TypeError

Error thrown when trying to get BYML as incorrect variant

Enums

Byml

Represents a Nintendo binary YAML (BYML) document or node. A Byml will usually be constructed from binary data or a YAML string, e.g.

BymlIndex

Convenience type for indexing a hash or array BYML node

Endian

Specifies endianness for binary BYML operations

NodeType

An enumeration of valid BYML node types