#[non_exhaustive]pub enum DecodeInvalidAction<Value> {
Reject,
Skip {
consumed: NonZeroUsize,
},
Emit {
value: Value,
consumed: NonZeroUsize,
},
}Expand description
Action selected after a codec reports invalid encoded input.
Incomplete input is not a policy action. Codecs report it with
crate::DecodeFailure::Incomplete, and the decode engine converts it
directly into crate::TranscodeStatus::NeedInput.
§Type Parameters
Value: Decoded output value type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Reject
Reject the current invalid input.
The decode engine reports the original codec decode error as
crate::TranscodeDecodeError::Domain at the current input index.
Skip
Consume invalid input without producing output.
consumed must not exceed the hook context’s available input count.
Over-consuming is a hook contract violation and panics in the engine.
Fields
consumed: NonZeroUsizeSource units to consume.
Emit
Produce one replacement value and consume source units.
consumed must not exceed the hook context’s available input count.
Over-consuming is a hook contract violation and panics in the engine.
Fields
value: ValueValue to write to the output buffer.
consumed: NonZeroUsizeSource units to consume.
Trait Implementations§
Source§impl<Value: Clone> Clone for DecodeInvalidAction<Value>
impl<Value: Clone> Clone for DecodeInvalidAction<Value>
Source§fn clone(&self) -> DecodeInvalidAction<Value>
fn clone(&self) -> DecodeInvalidAction<Value>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more