kiwi-schema 0.0.8

This is a Rust library with some helper routines for parsing files in the Kiwi serialization format.
Documentation

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", 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]);