Skip to main content

Preprocessor

Trait Preprocessor 

Source
pub trait Preprocessor: Send + Sync {
    // Required methods
    fn process(&mut self, data: &[u8]) -> (Vec<u8>, Vec<ParseError>);
    fn fork(&self) -> Box<dyn Preprocessor>;
    fn splitter(&self) -> Option<Box<dyn Splitter>>;
}
Expand description

Trait for preprocessing raw data before parsing.

Required Methods§

Source

fn process(&mut self, data: &[u8]) -> (Vec<u8>, Vec<ParseError>)

Process raw input data and return transformed data.

§Arguments
  • data - Raw input data bytes
§Returns

A PreprocessResult containing the transformed data or errors.

Source

fn fork(&self) -> Box<dyn Preprocessor>

Create a new preprocessor with the same configuration as self.

Used by multithreaded transport endpoints to create multiple parallel input pipelines.

Source

fn splitter(&self) -> Option<Box<dyn Splitter>>

Returns an object that can be used to break a stream of incoming data into complete records to pass to Preprocessor::process. If the object is None, the parser’s splitter object will actually be used.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§