pub trait Format {
type Input<'input>: ?Sized;
type SpanType: Debug + SubstackBehavior + 'static;
// Required methods
fn source(&self) -> &'static str;
fn next<'input, 'facet, 'shape>(
&mut self,
nd: NextData<'input, 'facet, 'shape, Self::SpanType, Self::Input<'input>>,
expectation: Expectation,
) -> NextResult<'input, 'facet, 'shape, Spanned<Outcome<'input>, Self::SpanType>, Spanned<DeserErrorKind<'shape>, Self::SpanType>, Self::SpanType, Self::Input<'input>>
where 'shape: 'input;
fn skip<'input, 'facet, 'shape>(
&mut self,
nd: NextData<'input, 'facet, 'shape, Self::SpanType, Self::Input<'input>>,
) -> NextResult<'input, 'facet, 'shape, Span<Self::SpanType>, Spanned<DeserErrorKind<'shape>, Self::SpanType>, Self::SpanType, Self::Input<'input>>
where 'shape: 'input;
}Expand description
Trait defining a deserialization format. Provides the next parsing step based on current state and expected input.
Required Associated Types§
Sourcetype Input<'input>: ?Sized
type Input<'input>: ?Sized
The kind of input this format consumes, parameterized by input lifetime.
JsonFmt=>Input<'input> = [u8]CliFmt=>Input<'input> = [&'input str]
Sourcetype SpanType: Debug + SubstackBehavior + 'static
type SpanType: Debug + SubstackBehavior + 'static
The type of span used by this format (Raw or Cooked)
Required Methods§
Sourcefn source(&self) -> &'static str
fn source(&self) -> &'static str
The lowercase source ID of the format, used for error reporting.
Sourcefn next<'input, 'facet, 'shape>(
&mut self,
nd: NextData<'input, 'facet, 'shape, Self::SpanType, Self::Input<'input>>,
expectation: Expectation,
) -> NextResult<'input, 'facet, 'shape, Spanned<Outcome<'input>, Self::SpanType>, Spanned<DeserErrorKind<'shape>, Self::SpanType>, Self::SpanType, Self::Input<'input>>where
'shape: 'input,
fn next<'input, 'facet, 'shape>(
&mut self,
nd: NextData<'input, 'facet, 'shape, Self::SpanType, Self::Input<'input>>,
expectation: Expectation,
) -> NextResult<'input, 'facet, 'shape, Spanned<Outcome<'input>, Self::SpanType>, Spanned<DeserErrorKind<'shape>, Self::SpanType>, Self::SpanType, Self::Input<'input>>where
'shape: 'input,
Advance the parser with current state and expectation, producing the next outcome or error.
Sourcefn skip<'input, 'facet, 'shape>(
&mut self,
nd: NextData<'input, 'facet, 'shape, Self::SpanType, Self::Input<'input>>,
) -> NextResult<'input, 'facet, 'shape, Span<Self::SpanType>, Spanned<DeserErrorKind<'shape>, Self::SpanType>, Self::SpanType, Self::Input<'input>>where
'shape: 'input,
fn skip<'input, 'facet, 'shape>(
&mut self,
nd: NextData<'input, 'facet, 'shape, Self::SpanType, Self::Input<'input>>,
) -> NextResult<'input, 'facet, 'shape, Span<Self::SpanType>, Spanned<DeserErrorKind<'shape>, Self::SpanType>, Self::SpanType, Self::Input<'input>>where
'shape: 'input,
Skip the next value; used to ignore an input.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.