Crate kiwi_schema
source ·Expand description
This is a Rust library with some helper routines for parsing files in the Kiwi serialization format. See https://github.com/evanw/kiwi for documentation about the format.
use kiwi_schema::*;
let schema = Schema::new(vec![
Def::new("Point".to_owned(), DefKind::Struct, vec![
Field {name: "x".to_owned(), type_id: TYPE_FLOAT, is_array: false, value: 0},
Field {name: "y".to_owned(), type_id: TYPE_FLOAT, is_array: false, value: 0},
]),
]);
let value = Value::decode(&schema, 0, &[126, 0, 0, 0, 126, 1, 0, 0]).unwrap();
assert_eq!(format!("{:?}", value), "Point {x: 0.5, y: -0.5}");
assert_eq!(value.encode(&schema), [126, 0, 0, 0, 126, 1, 0, 0]);
Structs
- A Kiwi byte buffer meant for reading.
- A Kiwi byte buffer meant for writing.
- Represents a single definition in a Schema. Kiwi enums, structs, and messages are all represented using this object.
- Represents a single field in a Def.
- Holds the contents of a Kiwi schema.
Enums
- This type holds dynamic Kiwi data.