pub trait Preprocessor: Send + Sync {
// Required methods
fn fork(&self) -> Box<dyn Preprocessor>;
fn splitter(&self) -> Option<Box<dyn Splitter>>;
// Provided methods
fn process(&mut self, data: &[u8]) -> (Vec<u8>, Vec<ParseError>) { ... }
fn process_with_metadata(
&mut self,
data: &[u8],
_metadata: Option<&ConnectorMetadata>,
) -> (Vec<u8>, Vec<ParseError>) { ... }
}Expand description
Trait for preprocessing raw data before parsing.
Required Methods§
Sourcefn fork(&self) -> Box<dyn Preprocessor>
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.
Provided Methods§
Sourcefn process_with_metadata(
&mut self,
data: &[u8],
_metadata: Option<&ConnectorMetadata>,
) -> (Vec<u8>, Vec<ParseError>)
fn process_with_metadata( &mut self, data: &[u8], _metadata: Option<&ConnectorMetadata>, ) -> (Vec<u8>, Vec<ParseError>)
Process raw input data and return transformed data using connector metadata.
Users should implement exactly one of the two processing methods: process or
process_with_metadata.
WARNING: a preprocessor that implements neither processing method compiles, but will panic at runtime with a stack overflow.
§Arguments
data- Raw input data bytes_metadata- Connector metadata
§Returns
The transformed data and any errors that occurred.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".