Check-in broken & partial try_read_u32 function
I'm saving this to the repo so I can possibly come back and fix it up correctly. A major API change is going to be attempted. The iterator-based stream processing has proven to be fiddly and annoying, so I'm going to switch to a processing the complete image.
This commit is contained in:
@@ -19,6 +19,11 @@ pub fn try_read_magic<I: Iterator<Item=u8>>(bytes: &mut I) -> Result<(), DecodeE
|
|||||||
|
|
||||||
fn try_read_u32<I: Iterator<Item=u8>>(bytes: &mut I) -> Result<u32, DecodeError> {
|
fn try_read_u32<I: Iterator<Item=u8>>(bytes: &mut I) -> Result<u32, DecodeError> {
|
||||||
let mut res: u32 = 0;
|
let mut res: u32 = 0;
|
||||||
|
let i = bytes.take(4)
|
||||||
|
.enumerate()
|
||||||
|
.reduce(|acc, (idx, val)| {
|
||||||
|
(0, 0)
|
||||||
|
});
|
||||||
|
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user