rustmax::nom

Trait OutputMode

Source
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§

Source

type Output: Mode

Defines the Mode for the output type. Emit will generate the value, Check will apply the parser but will only generate () if successful. This can be used when verifying that the input data conforms to the format without having to generate any output data

Source

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.

Source

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

Implementors§

Source§

impl<M, EM, S> OutputMode for OutputM<M, EM, S>
where M: Mode, EM: Mode, S: IsStreaming,