Trait Combinator

Source
pub trait Combinator: View
where Self::V: SecureSpecCombinator<SpecResult = <Self::Owned as View>::V>,
{ type Result<'a>: View<V = <Self::Owned as View>::V>; type Owned: View; // Required methods fn length(&self) -> Option<usize>; fn parse<'a>( &self, s: &'a [u8], ) -> Result<(usize, Self::Result<'a>), ParseError>; fn serialize( &self, v: Self::Result<'_>, data: &mut Vec<u8>, pos: usize, ) -> Result<usize, SerializeError>; }
Expand description

Implementation for parser and serializer combinators. A combinator’s view must be a SecureSpecCombinator.

Required Associated Types§

Source

type Result<'a>: View<V = <Self::Owned as View>::V>

The result type of parsing and the input type of serialization.

Source

type Owned: View

The owned parsed type. This is currently a hack to avoid lifetime bindings in SpecCombinator::SpecResult , but it can be useful if we want to have functions that return owned values (e.g. Vec<T>).

Required Methods§

Source

fn length(&self) -> Option<usize>

The length of the output buffer, if known. This can be used to optimize serialization by pre-allocating the buffer.

Source

fn parse<'a>( &self, s: &'a [u8], ) -> Result<(usize, Self::Result<'a>), ParseError>

The parsing function.

Source

fn serialize( &self, v: Self::Result<'_>, data: &mut Vec<u8>, pos: usize, ) -> Result<usize, SerializeError>

The serialization function.

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.

Implementations on Foreign Types§

Source§

impl<C> Combinator for &C
where C: Combinator, <C as View>::V: SecureSpecCombinator<SpecResult = <<C as Combinator>::Owned as View>::V>,

Source§

type Result<'a> = <C as Combinator>::Result<'a>

Source§

type Owned = <C as Combinator>::Owned

Source§

fn length(&self) -> Option<usize>

Source§

fn parse<'a>( &self, s: &'a [u8], ) -> Result<(usize, <&C as Combinator>::Result<'a>), ParseError>

Source§

fn serialize( &self, v: <&C as Combinator>::Result<'_>, data: &mut Vec<u8>, pos: usize, ) -> Result<usize, SerializeError>

Source§

impl<Fst, Snd> Combinator for (Fst, Snd)
where Fst: Combinator, Snd: Combinator, <Fst as View>::V: SecureSpecCombinator<SpecResult = <<Fst as Combinator>::Owned as View>::V>, <Snd as View>::V: SecureSpecCombinator<SpecResult = <<Snd as Combinator>::Owned as View>::V>,

Source§

type Result<'a> = (<Fst as Combinator>::Result<'a>, <Snd as Combinator>::Result<'a>)

Source§

type Owned = (<Fst as Combinator>::Owned, <Snd as Combinator>::Owned)

Source§

fn length(&self) -> Option<usize>

Source§

fn parse<'a>( &self, s: &'a [u8], ) -> Result<(usize, <(Fst, Snd) as Combinator>::Result<'a>), ParseError>

Source§

fn serialize( &self, v: <(Fst, Snd) as Combinator>::Result<'_>, data: &mut Vec<u8>, pos: usize, ) -> Result<usize, SerializeError>

Implementors§

Source§

impl Combinator for ASN1Tag

Source§

impl Combinator for Base128UInt

Source§

impl Combinator for BigInt

Source§

impl Combinator for BitString

Source§

impl Combinator for Boolean

Source§

impl Combinator for GeneralizedTime

Source§

impl Combinator for GeneralizedTimeInner

Source§

impl Combinator for IA5String

Source§

type Result<'a> = &'a str

Source§

type Owned = String

Source§

impl Combinator for Integer

Source§

impl Combinator for Length

Source§

impl Combinator for Null

Source§

impl Combinator for ObjectIdentifier

Source§

impl Combinator for OctetString

Source§

type Result<'a> = &'a [u8]

Source§

type Owned = Vec<u8>

Source§

impl Combinator for PrintableString

Source§

type Result<'a> = &'a str

Source§

type Owned = String

Source§

impl Combinator for UTCTime

Source§

impl Combinator for UTCTimeInner

Source§

impl Combinator for UTF8String

Source§

type Result<'a> = &'a str

Source§

type Owned = String

Source§

impl Combinator for VarInt

Source§

impl Combinator for VarUInt

Source§

impl Combinator for Base64

Source§

impl Combinator for Bytes

Source§

type Result<'a> = &'a [u8]

Source§

type Owned = Vec<u8>

Source§

impl Combinator for End

Source§

impl Combinator for Fail

Source§

impl Combinator for Tail

Source§

type Result<'a> = &'a [u8]

Source§

type Owned = Vec<u8>

Source§

impl Combinator for U8

Source§

impl Combinator for U16

Source§

impl Combinator for U32

Source§

impl Combinator for U64

Source§

impl Combinator for Unreachable

Source§

impl Combinator for AccessDescription

Source§

impl Combinator for AlgorithmIdentifier

Source§

impl Combinator for AttributeTypeAndValue

Source§

impl Combinator for AuthorityInfoAccess

Source§

impl Combinator for AuthorityKeyIdentifier

Source§

impl Combinator for BasicConstraints

Source§

type Result<'a> = PolyType<<ASN1<Boolean> as Combinator>::Result<'a>, <ASN1<Integer> as Combinator>::Result<'a>>

Source§

type Owned = PolyType<<ASN1<Boolean> as Combinator>::Owned, <ASN1<Integer> as Combinator>::Owned>

Source§

impl Combinator for Certificate

Source§

impl Combinator for CertificateInner

Source§

impl Combinator for CertificatePolicies

Source§

impl Combinator for DSAParam

Source§

type Result<'a> = PolyType<<ASN1<BigInt> as Combinator>::Result<'a>, <ASN1<BigInt> as Combinator>::Result<'a>, <ASN1<BigInt> as Combinator>::Result<'a>>

Source§

type Owned = PolyType<<ASN1<BigInt> as Combinator>::Owned, <ASN1<BigInt> as Combinator>::Owned, <ASN1<BigInt> as Combinator>::Owned>

Source§

impl Combinator for DigestInfo

Source§

impl Combinator for DirectoryString

Source§

impl Combinator for ECDSASigValue

Source§

type Result<'a> = PolyType<<ASN1<BigInt> as Combinator>::Result<'a>, <ASN1<BigInt> as Combinator>::Result<'a>>

Source§

type Owned = PolyType<<ASN1<BigInt> as Combinator>::Owned, <ASN1<BigInt> as Combinator>::Owned>

Source§

impl Combinator for ExtendedKeyUsage

Source§

impl Combinator for Extension

Source§

impl Combinator for Extensions

Source§

impl Combinator for GeneralName

Source§

impl Combinator for GeneralNames

Source§

impl Combinator for GeneralSubtree

Source§

impl Combinator for GeneralSubtrees

Source§

impl Combinator for Name

Source§

impl Combinator for NameConstraints

Source§

impl Combinator for PolicyInfo

Source§

impl Combinator for PublicKeyInfo

Source§

impl Combinator for RDN

Source§

impl Combinator for RSAParam

Source§

type Result<'a> = PolyType<<ASN1<BigInt> as Combinator>::Result<'a>, <ASN1<BigInt> as Combinator>::Result<'a>>

Source§

type Owned = PolyType<<ASN1<BigInt> as Combinator>::Owned, <ASN1<BigInt> as Combinator>::Owned>

Source§

impl Combinator for RSAPublicKey

Source§

type Result<'a> = PolyType<<ASN1<BigInt> as Combinator>::Result<'a>, <ASN1<BigInt> as Combinator>::Result<'a>>

Source§

type Owned = PolyType<<ASN1<BigInt> as Combinator>::Owned, <ASN1<BigInt> as Combinator>::Owned>

Source§

impl Combinator for TBSCertificate

Source§

impl Combinator for Time

Source§

impl Combinator for Validity

Source§

type Result<'a> = PolyType<<Time as Combinator>::Result<'a>, <Time as Combinator>::Result<'a>>

Source§

type Owned = PolyType<<Time as Combinator>::Owned, <Time as Combinator>::Owned>

Source§

impl<'a, Inner> Combinator for Tag<Inner, &'a [u8]>
where Inner: for<'b> Combinator<Result<'b> = &'b [u8], Owned = Vec<u8>>, <Inner as View>::V: SecureSpecCombinator<SpecResult = Seq<u8>>,

Source§

impl<C1, C2> Combinator for Default<C1::Owned, C1, C2>
where C1: Combinator, C2: Combinator, C1::Owned: PolyfillClone, for<'a> C1::Result<'a>: PolyfillEq + From<C1::Owned>, C1::V: SecureSpecCombinator<SpecResult = <C1::Owned as View>::V>, C2::V: SecureSpecCombinator<SpecResult = <C2::Owned as View>::V> + DisjointFrom<C1::V>,

Source§

type Result<'a> = PairValue<<C1 as Combinator>::Result<'a>, <C2 as Combinator>::Result<'a>>

Source§

type Owned = PairValue<<C1 as Combinator>::Owned, <C2 as Combinator>::Owned>

Source§

impl<C1, C2> Combinator for Optional<C1, C2>
where C1: Combinator, C2: Combinator, C1::V: SecureSpecCombinator<SpecResult = <C1::Owned as View>::V>, C2::V: SecureSpecCombinator<SpecResult = <C2::Owned as View>::V> + DisjointFrom<C1::V>,

Source§

impl<C1, C2> Combinator for Pair<C1, C2>
where C1: Combinator, C2: Combinator, C1::V: SecureSpecCombinator<SpecResult = <C1::Owned as View>::V>, C2::V: SecureSpecCombinator<SpecResult = <C2::Owned as View>::V>,

Source§

type Result<'a> = PairValue<<C1 as Combinator>::Result<'a>, <C2 as Combinator>::Result<'a>>

Source§

type Owned = PairValue<<C1 as Combinator>::Owned, <C2 as Combinator>::Owned>

Source§

impl<C> Combinator for vest::regular::repeat::Repeat<C>
where C: Combinator, <C as View>::V: SecureSpecCombinator<SpecResult = <<C as Combinator>::Owned as View>::V>,

Source§

impl<C: Combinator> Combinator for SequenceOf<C>
where <C as View>::V: SecureSpecCombinator<SpecResult = <C::Owned as View>::V>, for<'a> C::Result<'a>: PolyfillClone,

Source§

impl<C: Combinator> Combinator for verdict_parser::Repeat<C>
where <C as View>::V: SecureSpecCombinator<SpecResult = <C::Owned as View>::V>,

Source§

impl<Fst, Snd> Combinator for OrdChoice<Fst, Snd>
where Fst: Combinator, Snd: Combinator, <Fst as View>::V: SecureSpecCombinator<SpecResult = <<Fst as Combinator>::Owned as View>::V>, <Snd as View>::V: SecureSpecCombinator<SpecResult = <<Snd as Combinator>::Owned as View>::V> + DisjointFrom<<Fst as View>::V>,

Source§

type Result<'a> = Either<<Fst as Combinator>::Result<'a>, <Snd as Combinator>::Result<'a>>

Source§

type Owned = Either<<Fst as Combinator>::Owned, <Snd as Combinator>::Owned>

Source§

impl<Fst, Snd> Combinator for Preceded<Fst, Snd>
where Snd: Combinator, <Fst as View>::V: SecureSpecCombinator<SpecResult = ()>, Fst: for<'a> Combinator<Result<'a> = (), Owned = ()>, <Snd as View>::V: SecureSpecCombinator<SpecResult = <<Snd as Combinator>::Owned as View>::V>,

Source§

type Result<'a> = <Snd as Combinator>::Result<'a>

Source§

type Owned = <Snd as Combinator>::Owned

Source§

impl<Fst, Snd, C> Combinator for verdict_parser::Depend<Fst, Snd, C>
where Fst: Combinator, Snd: Combinator, Fst::V: SecureSpecCombinator<SpecResult = <Fst::Owned as View>::V>, Snd::V: SecureSpecCombinator<SpecResult = <Snd::Owned as View>::V>, C: for<'a> Continuation<Input<'a> = Fst::Result<'a>, Output = Snd>, for<'a> Fst::Result<'a>: PolyfillClone,

Source§

type Result<'a> = (<Fst as Combinator>::Result<'a>, <Snd as Combinator>::Result<'a>)

Source§

type Owned = (<Fst as Combinator>::Owned, <Snd as Combinator>::Owned)

Source§

impl<Fst, Snd, F> Combinator for vest::regular::depend::Depend<Fst, Snd, F>
where Fst: Combinator, Snd: Combinator, <Fst as View>::V: SecureSpecCombinator<SpecResult = <<Fst as Combinator>::Owned as View>::V>, <Snd as View>::V: SecureSpecCombinator<SpecResult = <<Snd as Combinator>::Owned as View>::V>, F: for<'a> Fn(<Fst as Combinator>::Result<'a>) -> Snd, <Fst as Combinator>::Result<'a>: for<'a> Copy,

Source§

type Result<'a> = (<Fst as Combinator>::Result<'a>, <Snd as Combinator>::Result<'a>)

Source§

type Owned = (<Fst as Combinator>::Owned, <Snd as Combinator>::Owned)

Source§

impl<Inner> Combinator for Cond<Inner>
where Inner: Combinator, <Inner as View>::V: SecureSpecCombinator<SpecResult = <<Inner as Combinator>::Owned as View>::V>,

Source§

type Result<'a> = <Inner as Combinator>::Result<'a>

Source§

type Owned = <Inner as Combinator>::Owned

Source§

impl<Inner, M> Combinator for Mapped<Inner, M>
where M: for<'a> Iso<Src<'a> = <Inner as Combinator>::Result<'a>, SrcOwned = <Inner as Combinator>::Owned>, Inner: Combinator, <Inner as Combinator>::Result<'a>: for<'a> From<<M as Iso>::Dst<'a>> + for<'a> View, <M as Iso>::Dst<'a>: for<'a> From<<Inner as Combinator>::Result<'a>> + for<'a> View, <M as View>::V: SpecIso<Src = <<Inner as Combinator>::Owned as View>::V, Dst = <<M as Iso>::DstOwned as View>::V>, <Inner as View>::V: SecureSpecCombinator<SpecResult = <<Inner as Combinator>::Owned as View>::V>, <<Inner as Combinator>::Owned as View>::V: SpecFrom<<<M as Iso>::DstOwned as View>::V>, <<M as Iso>::DstOwned as View>::V: SpecFrom<<<Inner as Combinator>::Owned as View>::V>,

Source§

type Result<'a> = <M as Iso>::Dst<'a>

Source§

type Owned = <M as Iso>::DstOwned

Source§

impl<Inner, M> Combinator for TryMap<Inner, M>
where M: for<'a> TryFromInto<Src<'a> = <Inner as Combinator>::Result<'a>, SrcOwned = <Inner as Combinator>::Owned>, Inner: Combinator, <Inner as Combinator>::Result<'a>: for<'a> TryFrom<<M as TryFromInto>::Dst<'a>> + for<'a> View, <M as TryFromInto>::Dst<'a>: for<'a> TryFrom<<Inner as Combinator>::Result<'a>> + for<'a> View, <M as View>::V: SpecTryFromInto<Src = <<Inner as Combinator>::Owned as View>::V, Dst = <<M as TryFromInto>::DstOwned as View>::V>, <Inner as View>::V: SecureSpecCombinator<SpecResult = <<Inner as Combinator>::Owned as View>::V>, <<Inner as Combinator>::Owned as View>::V: SpecTryFrom<<<M as TryFromInto>::DstOwned as View>::V>, <<M as TryFromInto>::DstOwned as View>::V: SpecTryFrom<<<Inner as Combinator>::Owned as View>::V>,

Source§

type Result<'a> = <M as TryFromInto>::Dst<'a>

Source§

type Owned = <M as TryFromInto>::DstOwned

Source§

impl<Inner, P> Combinator for Refined<Inner, P>
where P: for<'a> Pred<Input<'a> = <Inner as Combinator>::Result<'a>, InputOwned = <Inner as Combinator>::Owned>, Inner: Combinator, <P as View>::V: SpecPred<Input = <<Inner as Combinator>::Owned as View>::V>, <Inner as View>::V: SecureSpecCombinator<SpecResult = <<Inner as Combinator>::Owned as View>::V>,

Source§

type Result<'a> = <Inner as Combinator>::Result<'a>

Source§

type Owned = <Inner as Combinator>::Owned

Source§

impl<Inner, T> Combinator for Tag<Inner, T>
where <Inner as View>::V: SecureSpecCombinator<SpecResult = <T as View>::V>, Inner: for<'a> Combinator<Result<'a> = T, Owned = T>, T: FromToBytes,

Source§

impl<Inner, const N: usize> Combinator for Tag<Inner, [u8; N]>
where <Inner as View>::V: SecureSpecCombinator<SpecResult = Seq<u8>>, Inner: for<'b> Combinator<Result<'b> = &'b [u8], Owned = Vec<u8>>,

Source§

impl<Next> Combinator for AndThen<Bytes, Next>
where Next: Combinator, <Next as View>::V: SecureSpecCombinator<SpecResult = <<Next as Combinator>::Owned as View>::V>,

Source§

type Result<'a> = <Next as Combinator>::Result<'a>

Source§

type Owned = <Next as Combinator>::Owned

Source§

impl<T> Combinator for BuilderCombinator<T>
where T: Builder + View, <T as View>::V: Builder,

Source§

impl<T> Combinator for ASN1<T>
where <T as View>::V: SecureSpecCombinator<SpecResult = <<T as Combinator>::Owned as View>::V> + ASN1Tagged, T: ViewWithASN1Tagged + ASN1Tagged + Combinator,

Source§

type Result<'a> = <T as Combinator>::Result<'a>

Source§

type Owned = <T as Combinator>::Owned

Source§

impl<T: ASN1Tagged + Combinator> Combinator for ImplicitTag<T>
where <T as View>::V: SecureSpecCombinator<SpecResult = <<T as Combinator>::Owned as View>::V> + ASN1Tagged,

Source§

type Result<'a> = <T as Combinator>::Result<'a>

Source§

type Owned = <T as Combinator>::Owned

Source§

impl<T: Combinator> Combinator for ExplicitTag<T>
where <T as View>::V: SecureSpecCombinator<SpecResult = <<T as Combinator>::Owned as View>::V>, for<'a> T::Result<'a>: PolyfillClone,

Source§

type Result<'a> = <T as Combinator>::Result<'a>

Source§

type Owned = <T as Combinator>::Owned

Source§

impl<T: Combinator> Combinator for LengthWrapped<T>
where <T as View>::V: SecureSpecCombinator<SpecResult = <<T as Combinator>::Owned as View>::V>, for<'a> T::Result<'a>: PolyfillClone,

Source§

type Result<'a> = <T as Combinator>::Result<'a>

Source§

type Owned = <T as Combinator>::Owned

Source§

impl<T: Combinator> Combinator for Cached<T>
where T::V: SecureSpecCombinator<SpecResult = <T::Owned as View>::V>,

Source§

type Result<'a> = CachedValue<'a, T>

Source§

type Owned = <T as Combinator>::Owned

Source§

impl<const N: usize> Combinator for BytesN<N>

Source§

type Result<'a> = &'a [u8]

Source§

type Owned = Vec<u8>