1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! A zero-copy MAME ListInfo format DAT files parser and deserializer.
//!
//! ## Usage
//! listinfo-rs provides a lower-level zero-copy expression tree API
//! as well as a more user friendly Serde deserialization API.
//!
//! Illustrated here is an example with the expression tree API
//!
//! ```rust
//! #[test]
//! fn parse_cave_story() {
//! const CAVE_STORY: &str = r#"clrmamepro (
//! name "Cave Story"
//! description "Cave Story"
//! version 20161204
//! comment "libretro | www.libretro.com"
//! )
//! game (
//! name "Cave Story (En)"
//! description "Cave Story (En)"
//! developer "Studio Pixel"
//! releaseyear "2004"
//! rom (
//! name "Doukutsu.exe"
//! size 1478656
//! crc c5a2a3f6
//! md5 38695d3d69d7a0ada8178072dad4c58b
//! sha1 bb2d0441e073da9c584f23c2ad8c7ab8aac293bf
//! )
//! )
//! "#;
//!
//! let document = parse::parse_document(CAVE_STORY).unwrap();
//! let header = document.entry("clrmamepro").unwrap().next().unwrap();
//! let game = document.entry("game").unwrap().next().unwrap();
//! let rom = game.entry_unique("rom").unwrap();
//! assert_eq!(
//! header.entry_unique("name"),
//! Some(&EntryData::Scalar("Cave Story"))
//! );
//! assert_eq!(
//! game.entry_unique("name"),
//! Some(&EntryData::Scalar("Cave Story (En)"))
//! );
//! assert_eq!(
//! header.entry_unique("name"),
//! Some(&EntryData::Scalar("Cave Story"))
//! );
//! if let EntryData::SubEntry(rom) = rom {
//! assert_eq!(rom.value_unique("name"), Some("Doukutsu.exe"))
//! }
//! }
//! ```
//!
//! ## Features
//! listinfo-rs supports the following features
//! * `std` Enables `std` support (enabled by default)
//! * `deserialize` Enables support for serde deserialization
//!
//! ## `no_std`
//! listinfo-rs requires `alloc`, but otherwise is fully supported on `#![no_std]`
//! environments.
//!
//! You can enable `no_std` support like in Cargo.toml
//!
//! ```toml
//! listinfo = { version = "0.3", default-features = false }
//! ```
extern crate alloc;
extern crate std as alloc;
pub use *;
pub use *;