From c6e94fcb5b9fd0c9d2bb746ad487c643c311cbac Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Tue, 2 Jul 2024 13:19:14 -0500 Subject: [PATCH] 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. --- src/decoder.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/decoder.rs b/src/decoder.rs index 0fe5f31..859798e 100644 --- a/src/decoder.rs +++ b/src/decoder.rs @@ -19,8 +19,13 @@ pub fn try_read_magic>(bytes: &mut I) -> Result<(), DecodeE fn try_read_u32>(bytes: &mut I) -> Result { let mut res: u32 = 0; - - Ok(res) + let i = bytes.take(4) + .enumerate() + .reduce(|acc, (idx, val)| { + (0, 0) + }); + + Ok(res) } mod codec_utils {