pub trait Parser: Send + Sync {
// Required methods
fn parse(
&mut self,
data: &[u8],
metadata: Option<ConnectorMetadata>,
) -> (Option<Box<dyn InputBuffer>>, Vec<ParseError>);
fn stage(
&self,
buffers: Vec<Box<dyn InputBuffer>>,
) -> Box<dyn StagedBuffers>;
fn splitter(&self) -> Box<dyn Splitter>;
fn fork(&self) -> Box<dyn Parser>;
}Expand description
Parses raw bytes into database records.
Required Methods§
Sourcefn parse(
&mut self,
data: &[u8],
metadata: Option<ConnectorMetadata>,
) -> (Option<Box<dyn InputBuffer>>, Vec<ParseError>)
fn parse( &mut self, data: &[u8], metadata: Option<ConnectorMetadata>, ) -> (Option<Box<dyn InputBuffer>>, Vec<ParseError>)
Parses data into records and returns the records and any parse errors
that occurred.
XXX it would be even better if this were &self and avoided keeping
state entirely.
Sourcefn stage(&self, buffers: Vec<Box<dyn InputBuffer>>) -> Box<dyn StagedBuffers>
fn stage(&self, buffers: Vec<Box<dyn InputBuffer>>) -> Box<dyn StagedBuffers>
Stages all of the buffers, which must have been obtained from this
Parser or one forked from this one, into a StagedBuffers that may
later be used to push the collected data into the circuit. See
StagedBuffers for more information.
Sourcefn splitter(&self) -> Box<dyn Splitter>
fn splitter(&self) -> Box<dyn Splitter>
Returns an object that can be used to break a stream of incoming data into complete records to pass to Parser::parse.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".