pub struct PairRev<A, B>(pub B, pub A);Expand description
Sequential composition of formats A and B, where the direction of parsing is reversed compared to super::Pair.
Parsing semantics: parses B from the back, consumes the tail part of the input, then parses A.
Tuple Fields§
§0: B§1: ATrait Implementations§
Source§impl<A, B, AVal, BVal> ByteLen<(AVal, BVal)> for PairRev<A, B>
impl<A, B, AVal, BVal> ByteLen<(AVal, BVal)> for PairRev<A, B>
Source§impl<A, B> Consistency for PairRev<A, B>where
A: Consistency,
B: Consistency,
impl<A, B> Consistency for PairRev<A, B>where
A: Consistency,
B: Consistency,
Source§open spec fn consistent(&self, v: Self::Val) -> bool
open spec fn consistent(&self, v: Self::Val) -> bool
{ Pair(self.1, self.0).consistent((v.0, v.1)) }Source§type Val = (<A as Consistency>::Val, <B as Consistency>::Val)
type Val = (<A as Consistency>::Val, <B as Consistency>::Val)
The type of values whose consistency is being checked.
Source§impl<A, B> EquivSerializers for PairRev<A, B>where
A: EquivSerializersGeneral,
B: EquivSerializers,
impl<A, B> EquivSerializers for PairRev<A, B>where
A: EquivSerializersGeneral,
B: EquivSerializers,
Source§impl<A, B> GoodSerializer for PairRev<A, B>where
A: GoodSerializer,
B: GoodSerializer,
impl<A, B> GoodSerializer for PairRev<A, B>where
A: GoodSerializer,
B: GoodSerializer,
Source§open spec fn serialize_inv(&self) -> bool
open spec fn serialize_inv(&self) -> bool
{ Pair(self.1, self.0).serialize_inv() }Source§proof fn lemma_serialize_len(&self, v: Self::SVal)
proof fn lemma_serialize_len(&self, v: Self::SVal)
Source§impl<A: MinMaxByteLen, B: MinMaxByteLen> MinMaxByteLen for PairRev<A, B>
impl<A: MinMaxByteLen, B: MinMaxByteLen> MinMaxByteLen for PairRev<A, B>
Source§impl<A, B> NonMalleable for PairRev<A, B>
impl<A, B> NonMalleable for PairRev<A, B>
Source§open spec fn nonmal_inv(&self) -> bool
open spec fn nonmal_inv(&self) -> bool
{
&&& self.0.nonmal_inv()
&&& self.1.nonmal_inv()
&&& self.0.safe_inv()
&&& self.1.safe_inv()
}Source§proof fn lemma_parse_non_malleable(&self, buf1: Seq<u8>, buf2: Seq<u8>)
proof fn lemma_parse_non_malleable(&self, buf1: Seq<u8>, buf2: Seq<u8>)
Source§impl<A, B, AVal, BVal> Prepare<(AVal, BVal)> for PairRev<A, B>
impl<A, B, AVal, BVal> Prepare<(AVal, BVal)> for PairRev<A, B>
Source§impl<A: Productive, B: StaticByteLen + SafeParser<PVal = B::T>> Productive for PairRev<A, B>
impl<A: Productive, B: StaticByteLen + SafeParser<PVal = B::T>> Productive for PairRev<A, B>
Source§open spec fn productive_inv(&self) -> bool
open spec fn productive_inv(&self) -> bool
{ B::static_byte_len() > 0 || (self.1.productive_inv() && self.1.safe_inv()) }Source§proof fn lemma_productive(&self, s: Seq<u8>)
proof fn lemma_productive(&self, s: Seq<u8>)
Source§impl<A, B> SPRoundTripDps for PairRev<A, B>where
A: SPRoundTripDps + NonTailFmt + NoLookAhead,
B: StaticByteLen + EquivSerializers + GoodSerializer + SPRoundTrip,
impl<A, B> SPRoundTripDps for PairRev<A, B>where
A: SPRoundTripDps + NonTailFmt + NoLookAhead,
B: StaticByteLen + EquivSerializers + GoodSerializer + SPRoundTrip,
Source§open spec fn unambiguous(&self) -> bool
open spec fn unambiguous(&self) -> bool
{
&&& self.0.serialize_inv()
&&& self.0.equiv_inv()
&&& self.0.sp_roundtrip_inv()
&&& self.1.unambiguous()
&&& self.1.serialize_dps_inv()
&&& self.1.safe_inv()
&&& self.1.no_lookahead_inv()
}Source§proof fn theorem_serialize_dps_parse_roundtrip(&self, v: Self::T, obuf: Seq<u8>)
proof fn theorem_serialize_dps_parse_roundtrip(&self, v: Self::T, obuf: Seq<u8>)
Source§impl<A, B> SafeParser for PairRev<A, B>
impl<A, B> SafeParser for PairRev<A, B>
Source§impl<A, B> SoundParser for PairRev<A, B>
impl<A, B> SoundParser for PairRev<A, B>
Source§impl<A, B> SpecByteLen for PairRev<A, B>where
A: SpecByteLen,
B: SpecByteLen,
impl<A, B> SpecByteLen for PairRev<A, B>where
A: SpecByteLen,
B: SpecByteLen,
Source§impl<A, B> SpecParser for PairRev<A, B>
impl<A, B> SpecParser for PairRev<A, B>
Source§open spec fn spec_parse(&self, ibuf: Seq<u8>) -> Option<(int, Self::PVal)>
open spec fn spec_parse(&self, ibuf: Seq<u8>) -> Option<(int, Self::PVal)>
{
if ibuf.len() < B::static_byte_len() {
None
} else {
let prefix = ibuf.len() - B::static_byte_len();
match self.1.spec_parse(ibuf.take(prefix)) {
Some((n1, v1)) if n1 == prefix => {
match self.0.spec_parse(ibuf.skip(prefix)) {
Some((n2, v2)) if n2 == B::static_byte_len() => {
Some((n1 + n2, (v1, v2)))
}
_ => None,
}
}
_ => None,
}
}
}Source§type PVal = (<A as SpecParser>::PVal, <B as SpecParser>::PVal)
type PVal = (<A as SpecParser>::PVal, <B as SpecParser>::PVal)
The type of parsed values.
Source§impl<A, B> SpecSerializer for PairRev<A, B>where
A: SpecSerializer,
B: SpecSerializer,
impl<A, B> SpecSerializer for PairRev<A, B>where
A: SpecSerializer,
B: SpecSerializer,
Source§open spec fn spec_serialize(&self, v: Self::SVal) -> Seq<u8>
open spec fn spec_serialize(&self, v: Self::SVal) -> Seq<u8>
{ Pair(self.1, self.0).spec_serialize((v.0, v.1)) }Source§type SVal = (<A as SpecSerializer>::SVal, <B as SpecSerializer>::SVal)
type SVal = (<A as SpecSerializer>::SVal, <B as SpecSerializer>::SVal)
The type of values to be serialized.
Source§impl<A, B> SpecSerializerDps for PairRev<A, B>where
A: SpecSerializerDps,
B: SpecSerializerDps,
impl<A, B> SpecSerializerDps for PairRev<A, B>where
A: SpecSerializerDps,
B: SpecSerializerDps,
Source§open spec fn spec_serialize_dps(&self, v: Self::SValue, obuf: Seq<u8>) -> Seq<u8>
open spec fn spec_serialize_dps(&self, v: Self::SValue, obuf: Seq<u8>) -> Seq<u8>
{ self.1.spec_serialize_dps(v.0, self.0.spec_serialize_dps(v.1, seq![])) }Source§type SValue = (<A as SpecSerializerDps>::SValue, <B as SpecSerializerDps>::SValue)
type SValue = (<A as SpecSerializerDps>::SValue, <B as SpecSerializerDps>::SValue)
The type of values to be serialized.
Source§impl<A, B> StaticByteLen for PairRev<A, B>where
A: StaticByteLen,
B: StaticByteLen,
impl<A, B> StaticByteLen for PairRev<A, B>where
A: StaticByteLen,
B: StaticByteLen,
Source§open spec fn static_byte_len() -> nat
open spec fn static_byte_len() -> nat
{ A::static_byte_len() + B::static_byte_len() }Source§proof fn lemma_static_len_matches_byte_len(&self, v: Self::T)
proof fn lemma_static_len_matches_byte_len(&self, v: Self::T)
Source§impl<A, B> ValueByteLen for PairRev<A, B>where
A: ValueByteLen,
B: ValueByteLen,
impl<A, B> ValueByteLen for PairRev<A, B>where
A: ValueByteLen,
B: ValueByteLen,
Source§open spec fn value_byte_len(v: Self::T) -> nat
open spec fn value_byte_len(v: Self::T) -> nat
{ A::value_byte_len(v.0) + B::value_byte_len(v.1) }Source§proof fn lemma_value_len_matches_byte_len(&self, v: Self::T)
proof fn lemma_value_len_matches_byte_len(&self, v: Self::T)
impl<A: Copy, B: Copy> Copy for PairRev<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for PairRev<A, B>
impl<A, B> RefUnwindSafe for PairRev<A, B>where
B: RefUnwindSafe,
A: RefUnwindSafe,
impl<A, B> Send for PairRev<A, B>
impl<A, B> Sync for PairRev<A, B>
impl<A, B> Unpin for PairRev<A, B>
impl<A, B> UnsafeUnpin for PairRev<A, B>where
B: UnsafeUnpin,
A: UnsafeUnpin,
impl<A, B> UnwindSafe for PairRev<A, B>where
B: UnwindSafe,
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: From<T>,
impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: From<T>,
fn obeys_from_spec() -> bool
fn from_spec(v: T) -> VERUS_SPEC__A
§impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: Into<T>,
impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: Into<T>,
fn obeys_into_spec() -> bool
fn into_spec(self) -> T
§impl<T, U> IntoSpecImpl<U> for Twhere
U: From<T>,
impl<T, U> IntoSpecImpl<U> for Twhere
U: From<T>,
fn obeys_into_spec() -> bool
fn into_spec(self) -> U
Source§impl<C> NonAmbiguous for Cwhere
C: SPRoundTrip,
impl<C> NonAmbiguous for Cwhere
C: SPRoundTrip,
Source§open spec fn nonamb_inv(&self) -> bool
open spec fn nonamb_inv(&self) -> bool
{ self.sp_roundtrip_inv() }Source§proof fn lemma_serialize_injective(
&self,
v1: <C as Consistency>::Val,
v2: <C as Consistency>::Val,
)
proof fn lemma_serialize_injective( &self, v1: <C as Consistency>::Val, v2: <C as Consistency>::Val, )
Source§impl<C> PSRoundTrip for C
impl<C> PSRoundTrip for C
Source§open spec fn ps_roundtrip_inv(&self) -> bool
open spec fn ps_roundtrip_inv(&self) -> bool
{ self.safe_inv() && self.sound_inv() && self.nonmal_inv() && self.sp_roundtrip_inv() }Source§proof fn theorem_parse_serialize_roundtrip(&self, ibuf: Seq<u8>)
proof fn theorem_parse_serialize_roundtrip(&self, ibuf: Seq<u8>)
Source§impl<C> SPRoundTrip for C
impl<C> SPRoundTrip for C
Source§open spec fn sp_roundtrip_inv(&self) -> bool
open spec fn sp_roundtrip_inv(&self) -> bool
{ self.serialize_inv() && self.equiv_inv() && self.unambiguous() }