pub trait Parser<Input: View<V = Seq<u8>>>: SpecParser {
type PT: DeepView<V = Self::PVal>;
// Required method
exec fn parse(&self, ibuf: &Input) -> r : PResult<Self::PT>;
// Provided methods
open spec fn exec_inv(&self) -> bool { ... }
fn min_byte_len(&self) -> usize { ... }
}Expand description
An executable parser proved equivalent to a pure SpecParser.
Input is normally &[u8]. Successful parsing returns both the consumed
byte count and a value whose deep view is exactly the value returned by
SpecParser::spec_parse.
Required Associated Types§
Required Methods§
Provided Methods§
Sourceopen spec fn exec_inv(&self) -> bool
open spec fn exec_inv(&self) -> bool
{ true }Extra invariant required by this parser’s executable implementation.
Most formats leave this as true; functional and recursive
parser callbacks use it to connect executable code to their specifications.
Sourceexec fn min_byte_len(&self) -> usize
exec fn min_byte_len(&self) -> usize
A lower bound on the number of bytes one successful parse consumes.
This is a capacity hint for repetition formats.
Formats whose minimum is statically known should override it; the DSL compiler emits an override for every named format it generates.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<I, T, Spec, Exec> Parser<I> for (Spec, Exec)
impl<I, T, Spec, Exec> Parser<I> for (Spec, Exec)
Implementors§
Source§impl Parser<&[u8]> for ObjectIdentifierFmt
Available on crate feature alloc only.
impl Parser<&[u8]> for ObjectIdentifierFmt
alloc only.type PT = ObjectIdentifier
Source§impl<'i, C, const LIMIT: usize> Parser<&'i [u8]> for BerCharStringFmt<C, LIMIT>where
C: BerDecoderOwned,
Available on crate feature alloc only.
impl<'i, C, const LIMIT: usize> Parser<&'i [u8]> for BerCharStringFmt<C, LIMIT>where
C: BerDecoderOwned,
alloc only.type PT = <C as BerDecoderOwned>::Owned
Source§impl<'i, C> Parser<&'i [u8]> for BerSequenceFmt<C>
impl<'i, C> Parser<&'i [u8]> for BerSequenceFmt<C>
Source§impl<'i, C> Parser<&'i [u8]> for BerSequenceOfFmt<C>
Available on crate feature alloc only.
impl<'i, C> Parser<&'i [u8]> for BerSequenceOfFmt<C>
alloc only.Source§impl<'i, const DER: bool> Parser<&'i [u8]> for GeneralizedTimeFmt<DER>
impl<'i, const DER: bool> Parser<&'i [u8]> for GeneralizedTimeFmt<DER>
type PT = GeneralizedTime<'i>
Source§impl<'i, const DET: bool, const LIMIT: usize> Parser<&'i [u8]> for CborFmt<DET, LIMIT>where
CborRecBody<DET>: SpecRecBody<Param = (), T = CborValueSpec, Body = CborBodyFmt<DET>> + ParserRecBody<&'i [u8], EP = (), O = CborValue<'i>>,
<CborRecBody<DET> as SpecRecBody>::Body: Productive,
impl<'i, const DET: bool, const LIMIT: usize> Parser<&'i [u8]> for CborFmt<DET, LIMIT>where
CborRecBody<DET>: SpecRecBody<Param = (), T = CborValueSpec, Body = CborBodyFmt<DET>> + ParserRecBody<&'i [u8], EP = (), O = CborValue<'i>>,
<CborRecBody<DET> as SpecRecBody>::Body: Productive,
Source§impl<'i, const LIMIT: usize> Parser<&'i [u8]> for BerAnyFmt<LIMIT>
Available on crate feature alloc only.
impl<'i, const LIMIT: usize> Parser<&'i [u8]> for BerAnyFmt<LIMIT>
alloc only.Source§impl<'i, const LIMIT: usize> Parser<&'i [u8]> for BerBitStringFmt<LIMIT>
Available on crate feature alloc only.
impl<'i, const LIMIT: usize> Parser<&'i [u8]> for BerBitStringFmt<LIMIT>
alloc only.type PT = BitStringOwned
Source§impl<'i, const LIMIT: usize> Parser<&'i [u8]> for BerOctetStringFmt<LIMIT>
Available on crate feature alloc only.
impl<'i, const LIMIT: usize> Parser<&'i [u8]> for BerOctetStringFmt<LIMIT>
alloc only.Source§impl<'i> Parser<&'i [u8]> for BmpStringFmt
Available on crate feature alloc only.
impl<'i> Parser<&'i [u8]> for BmpStringFmt
alloc only.Source§impl<'i> Parser<&'i [u8]> for CborInitialFmt
impl<'i> Parser<&'i [u8]> for CborInitialFmt
type PT = CborInitial
Source§impl<'i> Parser<&'i [u8]> for PrintableStringFmt
impl<'i> Parser<&'i [u8]> for PrintableStringFmt
type PT = PrintableString<'i>
Source§impl<'i> Parser<&'i [u8]> for TeletexStringFmt
impl<'i> Parser<&'i [u8]> for TeletexStringFmt
type PT = TeletexString<'i>
Source§impl<'i> Parser<&'i [u8]> for UniversalStringFmt
Available on crate feature alloc only.
impl<'i> Parser<&'i [u8]> for UniversalStringFmt
alloc only.Source§impl<I, A, AVal, B> Parser<I> for Preceded<A, AVal, B, false>where
I: InputBuf,
A: Parser<I, PT = AVal> + SafeParser<PVal = AVal>,
B: Parser<I> + SafeParser,
AVal: DeepView<V = AVal>,
impl<I, A, AVal, B> Parser<I> for Preceded<A, AVal, B, false>where
I: InputBuf,
A: Parser<I, PT = AVal> + SafeParser<PVal = AVal>,
B: Parser<I> + SafeParser,
AVal: DeepView<V = AVal>,
Source§impl<I, A, AVal, B> Parser<I> for Preceded<A, AVal, B, true>where
I: InputBuf,
A: Parser<I, PT = AVal> + SafeParser<PVal = AVal>,
B: Parser<I> + SafeParser,
AVal: DeepView<V = AVal> + PartialEq + Structural,
impl<I, A, AVal, B> Parser<I> for Preceded<A, AVal, B, true>where
I: InputBuf,
A: Parser<I, PT = AVal> + SafeParser<PVal = AVal>,
B: Parser<I> + SafeParser,
AVal: DeepView<V = AVal> + PartialEq + Structural,
Source§impl<I, A, B, BVal> Parser<I> for Terminated<A, B, BVal, false>where
I: InputBuf,
A: Parser<I> + SafeParser,
B: Parser<I, PT = BVal> + SafeParser<PVal = BVal>,
BVal: DeepView<V = BVal>,
impl<I, A, B, BVal> Parser<I> for Terminated<A, B, BVal, false>where
I: InputBuf,
A: Parser<I> + SafeParser,
B: Parser<I, PT = BVal> + SafeParser<PVal = BVal>,
BVal: DeepView<V = BVal>,
Source§impl<I, A, B, BVal> Parser<I> for Terminated<A, B, BVal, true>where
I: InputBuf,
A: Parser<I> + SafeParser,
B: Parser<I, PT = BVal> + SafeParser<PVal = BVal>,
BVal: DeepView<V = BVal> + PartialEq + Structural,
impl<I, A, B, BVal> Parser<I> for Terminated<A, B, BVal, true>where
I: InputBuf,
A: Parser<I> + SafeParser,
B: Parser<I, PT = BVal> + SafeParser<PVal = BVal>,
BVal: DeepView<V = BVal> + PartialEq + Structural,
Source§impl<I, A, B, C, D, E> Parser<I> for Permute5<A, B, C, D, E>where
I: InputBuf,
A: Parser<I> + SafeParser,
B: Parser<I> + SafeParser,
C: Parser<I> + SafeParser,
D: Parser<I> + SafeParser,
E: Parser<I> + SafeParser,
impl<I, A, B, C, D, E> Parser<I> for Permute5<A, B, C, D, E>where
I: InputBuf,
A: Parser<I> + SafeParser,
B: Parser<I> + SafeParser,
C: Parser<I> + SafeParser,
D: Parser<I> + SafeParser,
E: Parser<I> + SafeParser,
Source§impl<I, A, B, C, D> Parser<I> for Permute4<A, B, C, D>where
I: InputBuf,
A: Parser<I> + SafeParser,
B: Parser<I> + SafeParser,
C: Parser<I> + SafeParser,
D: Parser<I> + SafeParser,
impl<I, A, B, C, D> Parser<I> for Permute4<A, B, C, D>where
I: InputBuf,
A: Parser<I> + SafeParser,
B: Parser<I> + SafeParser,
C: Parser<I> + SafeParser,
D: Parser<I> + SafeParser,
Source§impl<I, A, B> Parser<I> for Bind<A, B>where
I: InputBuf,
A: Parser<I> + SafeParser,
B::O: Parser<I> + SafeParser,
B: MapRef<A::PT, Input = A::PVal>,
impl<I, A, B> Parser<I> for Bind<A, B>where
I: InputBuf,
A: Parser<I> + SafeParser,
B::O: Parser<I> + SafeParser,
B: MapRef<A::PT, Input = A::PVal>,
Source§impl<I, A> Parser<I> for OptionalEnd<A>
impl<I, A> Parser<I> for OptionalEnd<A>
Source§impl<I, A> Parser<I> for RepeatTillEnd<A>
Available on crate feature alloc only.
impl<I, A> Parser<I> for RepeatTillEnd<A>
alloc only.