pub trait Splitter: Send + Sync {
// Required methods
fn input(&mut self, data: &[u8]) -> Option<usize>;
fn clear(&mut self);
}Expand description
Splits a data stream at boundaries between records.
Parser::parse or Preprocessor::process can only parse complete records. For a byte stream source, a format-specific Splitter allows a transport to find boundaries.
Required Methods§
Sourcefn input(&mut self, data: &[u8]) -> Option<usize>
fn input(&mut self, data: &[u8]) -> Option<usize>
Looks for a record boundary in data. Returns:
-
None, ifdatadoes not necessarily complete a record. -
Some(n), if the firstnbytes of data, plus any data previously presented for whichNonewas returned, form one or more complete records. Ifn < data.len(), then the caller should re-presentdata[n..]for further splitting.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".