Created
December 22, 2016 02:03
-
-
Save meh/4a14ca6811634d019e676da3080afa9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
named!(parse<Database>, | |
do_parse!( | |
tag!(&[0x1A, 0x01]) >> | |
name_section: le_i16 >> | |
boolean_section: le_i16 >> | |
number_section: le_i16 >> | |
string_offsets: le_i16 >> | |
string_section: le_i16 >> | |
names: flat_map!(take!(name_section), | |
take_until!("\x00")) >> | |
vvvvvvv | |
boolean: flat_map!(take!(boolean_section), | |
many0!(alt!( | |
tag!(&[0]) => { |_| false } | | |
tag!(&[1]) => { |_| true }))) >> | |
^^^^^^^^ | |
(Database { | |
names: names, | |
boolean: boolean, | |
number: Vec::new(), | |
string: Vec::new(), | |
}))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment