pub struct RnsSerialScanner { /* private fields */ }Expand description
Bytes that arrive with no frame open are taken as the body of a frame whose opening FLAG was missed, so they close at the next FLAG as one typically undecodable frame and the scanner realigns. RNS’s FLAG data FLAG FLAG data FLAG layout would otherwise let a mid-frame join lock the decoder a half-frame out of phase permanently.
Implementations§
Source§impl RnsSerialScanner
impl RnsSerialScanner
pub const fn new() -> RnsSerialScanner
pub fn reset(&mut self)
Sourcepub fn next_frame_into(
&mut self,
input: &[u8],
offset: &mut usize,
sink: &mut dyn FrameSink,
) -> Result<Option<usize>, DecodeError>
pub fn next_frame_into( &mut self, input: &[u8], offset: &mut usize, sink: &mut dyn FrameSink, ) -> Result<Option<usize>, DecodeError>
The next complete frame at or after *offset in input, its payload left in sink, advancing offset past the bytes consumed. Ok(Some(len)) is the payload length now in the sink (0 is a delimiter-only keepalive); Ok(None) means the chunk is exhausted mid-frame, with the partial payload accumulated in the sink to be continued by the next chunk. A frame past the sink’s capacity is discarded whole (DecodeError::FrameTooBig, sink cleared) and scanning realigns at the next FLAG.
Trait Implementations§
Source§impl Clone for RnsSerialScanner
impl Clone for RnsSerialScanner
Source§fn clone(&self) -> RnsSerialScanner
fn clone(&self) -> RnsSerialScanner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more