pub struct Pair<A, B>(pub A, pub B);Expand description
Sequential composition of formats A and B.
Tuple Fields§
§0: A§1: BTrait Implementations§
Source§impl<A, B> Consistency for Pair<A, B>where
A: Consistency,
B: Consistency,
impl<A, B> Consistency for Pair<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
{ self.0.consistent(v.0) && self.1.consistent(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<D1: DepCombinator, D2: DepCombinator> DepCombinator for Pair<D1, D2>
impl<D1: DepCombinator, D2: DepCombinator> DepCombinator for Pair<D1, D2>
Source§open spec fn apply(&self, key: Self::Key) -> Self::Body
open spec fn apply(&self, key: Self::Key) -> Self::Body
{ Pair(self.0.apply(key.0), self.1.apply(key.1)) }Source§open spec fn recover(&self, value: Self::Val) -> Self::Key
open spec fn recover(&self, value: Self::Val) -> Self::Key
{ (self.0.recover(value.0), self.1.recover(value.1)) }Source§open spec fn recover_inv(&self) -> bool
open spec fn recover_inv(&self) -> bool
{ self.0.recover_inv() && self.1.recover_inv() }Source§proof fn lemma_recover_consistent(&self, key: Self::Key, value: Self::Val)
proof fn lemma_recover_consistent(&self, key: Self::Key, value: Self::Val)
Source§type Key = (<D1 as DepCombinator>::Key, <D2 as DepCombinator>::Key)
type Key = (<D1 as DepCombinator>::Key, <D2 as DepCombinator>::Key)
The type of keys parsed by the head combinator/to be recovered during serialization.
Source§type Val = (<D1 as DepCombinator>::Val, <D2 as DepCombinator>::Val)
type Val = (<D1 as DepCombinator>::Val, <D2 as DepCombinator>::Val)
The type of values consumed/produced by the body combinator.
Source§type Body = Pair<<D1 as DepCombinator>::Body, <D2 as DepCombinator>::Body>
type Body = Pair<<D1 as DepCombinator>::Body, <D2 as DepCombinator>::Body>
The type of the body combinator produced by
apply.Source§impl<A, B, TA, TB> DerOrd<(TA, TB)> for Pair<A, B>
impl<A, B, TA, TB> DerOrd<(TA, TB)> for Pair<A, B>
Source§proof fn lemma_der_serialize_len(&self, value: (TA::V, TB::V))
proof fn lemma_der_serialize_len(&self, value: (TA::V, TB::V))
Source§open spec fn der_remaining(
&self,
value: (TA::V, TB::V),
state: PairDerState<A::State, B::State>,
) -> Seq<u8>
open spec fn der_remaining( &self, value: (TA::V, TB::V), state: PairDerState<A::State, B::State>, ) -> Seq<u8>
{
if state.in_left {
self.0.der_remaining(value.0, state.left)
+ self.1.der_remaining(value.1, state.right)
} else {
self.1.der_remaining(value.1, state.right)
}
}Source§open spec fn der_state_valid(
&self,
value: (TA::V, TB::V),
state: PairDerState<A::State, B::State>,
) -> bool
open spec fn der_state_valid( &self, value: (TA::V, TB::V), state: PairDerState<A::State, B::State>, ) -> bool
{
&&& self.0.der_state_valid(value.0, state.left)
&&& self.1.der_state_valid(value.1, state.right)
&&& !state.in_left ==> self.0.der_remaining(value.0, state.left).len() == 0
}Source§impl<A, B> EquivSerializers for Pair<A, B>where
A: EquivSerializersGeneral,
B: EquivSerializers,
impl<A, B> EquivSerializers for Pair<A, B>where
A: EquivSerializersGeneral,
B: EquivSerializers,
Source§impl<A, B> EquivSerializersGeneral for Pair<A, B>where
A: EquivSerializersGeneral,
B: EquivSerializersGeneral,
impl<A, B> EquivSerializersGeneral for Pair<A, B>where
A: EquivSerializersGeneral,
B: EquivSerializersGeneral,
Source§open spec fn equiv_general_inv(&self) -> bool
open spec fn equiv_general_inv(&self) -> bool
{
&&& self.0.equiv_general_inv()
&&& self.1.equiv_general_inv()
}Source§proof fn lemma_serialize_equiv(&self, v: Self::SVal, obuf: Seq<u8>)
proof fn lemma_serialize_equiv(&self, v: Self::SVal, obuf: Seq<u8>)
Source§impl<A, B> GoodSerializer for Pair<A, B>where
A: GoodSerializer,
B: GoodSerializer,
impl<A, B> GoodSerializer for Pair<A, B>where
A: GoodSerializer,
B: GoodSerializer,
Source§open spec fn serialize_inv(&self) -> bool
open spec fn serialize_inv(&self) -> bool
{
&&& self.0.serialize_inv()
&&& self.1.serialize_inv()
}Source§proof fn lemma_serialize_len(&self, v: Self::SVal)
proof fn lemma_serialize_len(&self, v: Self::SVal)
Source§impl<Left: HasAsn1Start, Right: SpecParser> HasAsn1Start for Pair<Left, Right>
A required pair starts wherever its required left component starts.
impl<Left: HasAsn1Start, Right: SpecParser> HasAsn1Start for Pair<Left, Right>
A required pair starts wherever its required left component starts.
Source§open spec fn asn1_start(&self) -> Asn1StartDomain
open spec fn asn1_start(&self) -> Asn1StartDomain
{ self.0.asn1_start() }Source§proof fn lemma_parse_implies_asn1_start(&self, input: Seq<u8>)
proof fn lemma_parse_implies_asn1_start(&self, input: Seq<u8>)
Source§impl<A: MinMaxByteLen, B: MinMaxByteLen> MinMaxByteLen for Pair<A, B>
impl<A: MinMaxByteLen, B: MinMaxByteLen> MinMaxByteLen for Pair<A, B>
Source§impl<A: NoLookAhead, B: NoLookAhead> NoLookAhead for Pair<A, B>
impl<A: NoLookAhead, B: NoLookAhead> NoLookAhead for Pair<A, B>
Source§open spec fn no_lookahead_inv(&self) -> bool
open spec fn no_lookahead_inv(&self) -> bool
{
&&& self.0.no_lookahead_inv()
&&& self.1.no_lookahead_inv()
}Source§proof fn lemma_no_lookahead(&self, i1: Seq<u8>, i2: Seq<u8>)
proof fn lemma_no_lookahead(&self, i1: Seq<u8>, i2: Seq<u8>)
Source§impl<A: NonMalleable, B: NonMalleable> NonMalleable for Pair<A, B>
impl<A: NonMalleable, B: NonMalleable> NonMalleable for Pair<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> NonTailFmt for Pair<A, B>where
A: NonTailFmt,
B: NonTailFmt,
impl<A, B> NonTailFmt for Pair<A, B>where
A: NonTailFmt,
B: NonTailFmt,
Source§open spec fn serialize_dps_inv(&self) -> bool
open spec fn serialize_dps_inv(&self) -> bool
{
&&& self.0.serialize_dps_inv()
&&& self.1.serialize_dps_inv()
}Source§proof fn lemma_serialize_dps_prepend(&self, v: Self::SValue, obuf: Seq<u8>)
proof fn lemma_serialize_dps_prepend(&self, v: Self::SValue, obuf: Seq<u8>)
Source§proof fn lemma_serialize_dps_len(&self, v: Self::SValue, obuf: Seq<u8>)
proof fn lemma_serialize_dps_len(&self, v: Self::SValue, obuf: Seq<u8>)
Source§impl<A: Productive, B: Productive> Productive for Pair<A, B>
impl<A: Productive, B: Productive> Productive for Pair<A, B>
Source§open spec fn productive_inv(&self) -> bool
open spec fn productive_inv(&self) -> bool
{
||| self.0.productive_inv()
||| self.1.productive_inv()
}Source§proof fn lemma_productive(&self, s: Seq<u8>)
proof fn lemma_productive(&self, s: Seq<u8>)
Source§impl<A: SPRoundTripDps + NonTailFmt, B: SPRoundTripDps> SPRoundTripDps for Pair<A, B>
impl<A: SPRoundTripDps + NonTailFmt, B: SPRoundTripDps> SPRoundTripDps for Pair<A, B>
Source§open spec fn unambiguous(&self) -> bool
open spec fn unambiguous(&self) -> bool
{
&&& self.0.serialize_dps_inv()
&&& self.0.unambiguous()
&&& self.1.unambiguous()
}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 Pair<A, B>where
A: SafeParser,
B: SafeParser,
impl<A, B> SafeParser for Pair<A, B>where
A: SafeParser,
B: SafeParser,
Source§impl<Output: OutputBuf, A, B, TA, TB> Serializer<Output, (TA, TB)> for Pair<A, B>where
TA: DeepView,
TB: DeepView,
A: Serializer<Output, TA>,
B: Serializer<Output, TB>,
impl<Output: OutputBuf, A, B, TA, TB> Serializer<Output, (TA, TB)> for Pair<A, B>where
TA: DeepView,
TB: DeepView,
A: Serializer<Output, TA>,
B: Serializer<Output, TB>,
Source§exec fn serialize_into(&self, v: &(TA, TB), obuf: &mut Output)
exec fn serialize_into(&self, v: &(TA, TB), obuf: &mut Output)
Source§impl<A, B> SoundParser for Pair<A, B>where
A: SoundParser,
B: SoundParser,
impl<A, B> SoundParser for Pair<A, B>where
A: SoundParser,
B: SoundParser,
Source§impl<A: SpecByteLen, B: SpecByteLen> SpecByteLen for Pair<A, B>
impl<A: SpecByteLen, B: SpecByteLen> SpecByteLen for Pair<A, B>
Source§impl<A, B> SpecParser for Pair<A, B>where
A: SpecParser,
B: SpecParser,
impl<A, B> SpecParser for Pair<A, B>where
A: SpecParser,
B: SpecParser,
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)>
{
match self.0.spec_parse(ibuf) {
Some((n1, v1)) => {
match self.1.spec_parse(ibuf.skip(n1)) {
Some((n2, v2)) => Some((n1 + n2, (v1, v2))),
None => None,
}
}
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 Pair<A, B>where
A: SpecSerializer,
B: SpecSerializer,
impl<A, B> SpecSerializer for Pair<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>
{ self.0.spec_serialize(v.0) + self.1.spec_serialize(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 Pair<A, B>where
A: SpecSerializerDps,
B: SpecSerializerDps,
impl<A, B> SpecSerializerDps for Pair<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.0.spec_serialize_dps(v.0, self.1.spec_serialize_dps(v.1, obuf)) }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: StaticByteLen, B: StaticByteLen> StaticByteLen for Pair<A, B>
impl<A: StaticByteLen, B: StaticByteLen> StaticByteLen for Pair<A, B>
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: ValueByteLen, B: ValueByteLen> ValueByteLen for Pair<A, B>
impl<A: ValueByteLen, B: ValueByteLen> ValueByteLen for Pair<A, B>
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 Pair<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for Pair<A, B>
impl<A, B> RefUnwindSafe for Pair<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Pair<A, B>
impl<A, B> Sync for Pair<A, B>
impl<A, B> Unpin for Pair<A, B>
impl<A, B> UnsafeUnpin for Pair<A, B>where
A: UnsafeUnpin,
B: UnsafeUnpin,
impl<A, B> UnwindSafe for Pair<A, B>where
A: UnwindSafe,
B: 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() }