diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2020-12-07 15:31:29 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2020-12-07 15:31:29 +0100 |
commit | 1121cd690522e265033c96cf28568b6fe533b613 (patch) | |
tree | 9a5929fe35df361ca7ec7821e035bee5dd39c710 /src | |
parent | 116962a3b059323a3214dcad040997adef3c5bb7 (diff) | |
download | cbconv-1121cd690522e265033c96cf28568b6fe533b613.tar.gz cbconv-1121cd690522e265033c96cf28568b6fe533b613.tar.bz2 cbconv-1121cd690522e265033c96cf28568b6fe533b613.zip |
Use map to convert FOURCC tag to &str.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index dfeea93..9425106 100644 --- a/src/main.rs +++ b/src/main.rs @@ -98,9 +98,8 @@ fn p_arrangement<'a>(data: &'a [u8]) -> IResult<&'a [u8], PArrangement> { Ok((data, v)) } -fn fourcc<'a>(data: &'a [u8]) -> IResult<&'a [u8], &'a str> { - let (rest, tag) = take(4usize)(data)?; - Ok((rest, std::str::from_utf8(tag).unwrap())) +fn fourcc<'a>(input: &'a [u8]) -> IResult<&'a [u8], &'a str> { + map(take(4usize), |tag| std::str::from_utf8(tag).unwrap())(input) } /** |