Skip to main content

Crate brine_kiwi_schema

Crate brine_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 brine_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]);

Re-exports§

pub use bb::*;
pub use schema::*;
pub use value::*;

Modules§

bb
schema
value

Constants§

TYPE_BOOL
TYPE_BYTE
TYPE_FLOAT
TYPE_INT
TYPE_INT64
TYPE_STRING
TYPE_UINT
TYPE_UINT64