diff options
-rw-r--r-- | src/main.rs | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/main.rs b/src/main.rs index bf5c2d9..802d50e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,7 +78,7 @@ enum NodeValue<'a> { SignatureTrackEvent(MSignatureTrackEvent<'a>), TempoTrackEvent(&'a [u8]), - Version(PAppVersion<'a>), + Version(PAppVersion), } /// A vector of 32bit words preceeded by a 16 bit count. @@ -92,32 +92,19 @@ fn bytevec<'a>(data: &'a[u8]) -> IResult<&'a [u8], &'a [u8]> { length_data(be_u32)(&data) } -/// Version information about the app that created the file. -#[derive(Debug)] -struct PAppVersion<'a> { - appname: &'a str, - appversion: &'a str, - appdate: &'a str, - num2: u32, - apparch: &'a str, - num3: u32, - appencoding: &'a str, - applocale: &'a str, -} - -fn p_appversion<'a>(data: &'a [u8]) -> IResult<&'a [u8], PAppVersion<'a>> { +fn p_appversion<'a>(data: &'a [u8]) -> IResult<&'a [u8], PAppVersion> { let (r, (appname, appversion, appdate, num2, apparch, num3, appencoding, applocale)) = tuple((cmstring, cmstring, cmstring, be_u32, cmstring, be_u32, cmstring, cmstring))(&data)?; Ok((r, PAppVersion { - appname, - appversion, - appdate, + appname: String::from(appname), + appversion: String::from(appversion), + appdate: String::from(appdate), num2, - apparch, + apparch: String::from(apparch), num3, - appencoding, - applocale, + appencoding: String::from(appencoding), + applocale: String::from(applocale), })) } |