use super::{PatternSplitter, StreamSplitter}; use std::io; static FRAME_HEADER: [u8; 8] = [0x4f, 0x4f, 0x4f, 0x4f, 0xff, 0xff, 0xff, 0xff]; /// Iterator that returns exactly one frame worth of data from a FWHT stream. pub struct FwhtFrameParser(PatternSplitter); /// Given a reader, return individual compressed FWHT frames. impl FwhtFrameParser { pub fn new(stream: S) -> Option { Some(Self(PatternSplitter::new(FRAME_HEADER.to_vec(), stream)?)) } } impl Iterator for FwhtFrameParser { type Item = Vec; /// Returns the next frame in the stream, header included. fn next(&mut self) -> Option { self.0.next() } } impl StreamSplitter for FwhtFrameParser {}