pub struct AndThen<A, B>(pub A, pub B);Expand description
Run a bytes combinator A and then
re-interpret the entire bytes consumed/produced by A with another combinator B.
§Consistency
A value of type B::Val is consistent w.r.t AndThen<A, B> iff there exists a value of type
A::Val that is consistent w.r.t A and whose byte length equals the byte length of the B::Val value w.r.t B.
Prefer ExactLen over AndThen to avoid the existential reasoning in the consistency condition.
Tuple Fields§
§0: A§1: BTrait Implementations§
Source§impl<A, Then> Consistency for AndThen<A, Then>where
A: BytesCombinator + Consistency<Val = Seq<u8>>,
Then: Consistency + SpecByteLen<T = Then::Val>,
impl<A, Then> Consistency for AndThen<A, Then>where
A: BytesCombinator + Consistency<Val = Seq<u8>>,
Then: Consistency + SpecByteLen<T = Then::Val>,
Source§open spec fn consistent(&self, v: Self::Val) -> bool
open spec fn consistent(&self, v: Self::Val) -> bool
{
&&& self.1.consistent(v)
&&& exists |chunk: Seq<u8>| {
self.0.consistent(chunk) && self.0.byte_len(chunk) == self.1.byte_len(v)
}
}Source§type Val = <Then as Consistency>::Val
type Val = <Then as Consistency>::Val
The type of values whose consistency is being checked.
Source§impl<A, Then> EquivSerializers for AndThen<A, Then>
impl<A, Then> EquivSerializers for AndThen<A, Then>
Source§impl<A, Then> EquivSerializersGeneral for AndThen<A, Then>
impl<A, Then> EquivSerializersGeneral for AndThen<A, Then>
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_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, Then> GoodSerializer for AndThen<A, Then>
impl<A, Then> GoodSerializer for AndThen<A, Then>
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<A, Then> MinMaxByteLen for AndThen<A, Then>
impl<A, Then> MinMaxByteLen for AndThen<A, Then>
Source§impl<A, Then> NoLookAhead for AndThen<A, Then>
impl<A, Then> NoLookAhead for AndThen<A, Then>
Source§open spec fn no_lookahead_inv(&self) -> bool
open spec fn no_lookahead_inv(&self) -> bool
{ self.0.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, Then> NonMalleable for AndThen<A, Then>
impl<A, Then> NonMalleable for AndThen<A, Then>
Source§open spec fn nonmal_inv(&self) -> bool
open spec fn nonmal_inv(&self) -> bool
{
&&& self.0.nonmal_inv()
&&& self.0.sound_inv()
&&& self.1.nonmal_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, Then> NonTailFmt for AndThen<A, Then>
impl<A, Then> NonTailFmt for AndThen<A, Then>
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_inv()
&&& self.1.equiv_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, Then> Productive for AndThen<A, Then>
impl<A, Then> Productive for AndThen<A, Then>
Source§open spec fn productive_inv(&self) -> bool
open spec fn productive_inv(&self) -> bool
{ self.0.productive_inv() }Source§proof fn lemma_productive(&self, s: Seq<u8>)
proof fn lemma_productive(&self, s: Seq<u8>)
Source§impl<Then> SPRoundTripDps for AndThen<Tail, Then>
impl<Then> SPRoundTripDps for AndThen<Tail, Then>
Source§open spec fn unambiguous(&self) -> bool
open spec fn unambiguous(&self) -> bool
{
&&& self.1.serialize_inv()
&&& self.1.equiv_inv()
&&& self.1.sp_roundtrip_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<Len, Then> SPRoundTripDps for AndThen<Varied<Len>, Then>
impl<Len, Then> SPRoundTripDps for AndThen<Varied<Len>, Then>
Source§open spec fn unambiguous(&self) -> bool
open spec fn unambiguous(&self) -> bool
{
&&& self.1.serialize_inv()
&&& self.1.equiv_inv()
&&& self.1.sp_roundtrip_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, Then> SafeParser for AndThen<A, Then>
impl<A, Then> SafeParser for AndThen<A, Then>
Source§impl<Output: OutputBuf, Then, T> Serializer<Output, T> for AndThen<Tail, Then>where
T: DeepView + ?Sized,
Then: Serializer<Output, T>,
impl<Output: OutputBuf, Then, T> Serializer<Output, T> for AndThen<Tail, Then>where
T: DeepView + ?Sized,
Then: Serializer<Output, T>,
Source§exec fn serialize_into(&self, v: &T, obuf: &mut Output)
exec fn serialize_into(&self, v: &T, obuf: &mut Output)
Source§impl<A, Then> SoundParser for AndThen<A, Then>
impl<A, Then> SoundParser for AndThen<A, Then>
Source§impl<A, Then: SpecByteLen> SpecByteLen for AndThen<A, Then>
impl<A, Then: SpecByteLen> SpecByteLen for AndThen<A, Then>
Source§impl<A, Then> SpecParser for AndThen<A, Then>
impl<A, Then> SpecParser for AndThen<A, Then>
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) {
None => None,
Some((len_a, chunk)) => {
match self.1.spec_parse(chunk) {
Some((len_b, v)) if len_a == len_b => Some((len_a, v)),
_ => None,
}
}
}
}Source§type PVal = <Then as SpecParser>::PVal
type PVal = <Then as SpecParser>::PVal
The type of parsed values.
Source§impl<A, Then> SpecSerializer for AndThen<A, Then>
impl<A, Then> SpecSerializer for AndThen<A, Then>
Source§open spec fn spec_serialize(&self, v: Self::SVal) -> Seq<u8>
open spec fn spec_serialize(&self, v: Self::SVal) -> Seq<u8>
{
let inner_bytes = self.1.spec_serialize(v);
self.0.spec_serialize(inner_bytes)
}Source§type SVal = <Then as SpecSerializer>::SVal
type SVal = <Then as SpecSerializer>::SVal
The type of values to be serialized.
Source§impl<A, Then> SpecSerializerDps for AndThen<A, Then>
impl<A, Then> SpecSerializerDps for AndThen<A, Then>
Source§impl<A, Then> ValueByteLen for AndThen<A, Then>
impl<A, Then> ValueByteLen for AndThen<A, Then>
Source§open spec fn value_byte_len(v: Self::T) -> nat
open spec fn value_byte_len(v: Self::T) -> nat
{ Then::value_byte_len(v) }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 AndThen<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for AndThen<A, B>
impl<A, B> RefUnwindSafe for AndThen<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for AndThen<A, B>
impl<A, B> Sync for AndThen<A, B>
impl<A, B> Unpin for AndThen<A, B>
impl<A, B> UnsafeUnpin for AndThen<A, B>where
A: UnsafeUnpin,
B: UnsafeUnpin,
impl<A, B> UnwindSafe for AndThen<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() }