pub trait OutputMode {
type Output: Mode;
type Error: Mode;
type Incomplete: IsStreaming;
}
Expand description
Trait Defining the parser’s execution
The same parser implementation can vary in behaviour according to the chosen output mode
Required Associated Types§
Sourcetype Error: Mode
type Error: Mode
Defines the Mode for the output type. Emit will generate the value, Check will
apply the parser but will only generate ()
if an error happened. Emit should be
used when we want to handle the error and extract useful information from it. Check
is used when we just want to know if parsing failed and reject the data quickly.
Sourcetype Incomplete: IsStreaming
type Incomplete: IsStreaming
Indicates whether the input data is “complete”, ie we already have the entire data in the buffer, or if it is “streaming”, where more data can be added later in the buffer. In streaming mode, the parser will understand that a failure may mean that we are missing data, and will return a specific error branch, Err::Incomplete to signal it. In complete mode, the parser will generate a normal error