wayland-protocol-parser 0.1.0

Wayland XML protocol parser
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
extern crate serde;
extern crate serde_json;
extern crate wayland_protocol_parser;

const XML: &[u8] = include_bytes!("wayland.xml");
const JSON: &[u8] = include_bytes!("wayland.json");

#[cfg(not(feature = "serde"))]
compile_error!("this test requires the serde feature to be enabled");

#[test]
fn core_protocol() {
    let mut xml = std::io::Cursor::new(XML);
    let protocol_xml = wayland_protocol_parser::parse(&mut xml).unwrap();
    let mut json = std::io::Cursor::new(JSON);
    let protocol_json = serde_json::from_reader(&mut json).unwrap();
    assert_eq!(protocol_xml, protocol_json);
}