pub struct RepeatN<C, N = u8>(pub N, pub C);Expand description
Exactly N repetitions of combinator C (N is a runtime value).
Tuple Fields§
§0: N§1: CImplementations§
Source§impl<C: SpecParser, N: AsLen> RepeatN<C, N>
impl<C: SpecParser, N: AsLen> RepeatN<C, N>
Sourcepub open spec fn parse_n_rec(
&self,
count: nat,
ibuf: Seq<u8>,
) -> Option<(int, Seq<C::PVal>)>
pub open spec fn parse_n_rec( &self, count: nat, ibuf: Seq<u8>, ) -> Option<(int, Seq<C::PVal>)>
{
if count == 0 {
Some((0, Seq::empty()))
} else {
match self.1.spec_parse(ibuf) {
Some((n0, v0)) => {
match self.parse_n_rec((count - 1) as nat, ibuf.skip(n0)) {
Some((n1, vs1)) => Some((n0 + n1, seq![v0] + vs1)),
None => None,
}
}
None => None,
}
}
}Sourcepub proof fn lemma_parse_exactly_n_times(&self, ibuf: Seq<u8>)
pub proof fn lemma_parse_exactly_n_times(&self, ibuf: Seq<u8>)
ensures
self.spec_parse(ibuf) matches Some((_, vs)) ==> vs.len() == self.0.as_nat(),Trait Implementations§
Source§impl<C: Consistency, N: AsLen> Consistency for RepeatN<C, N>
impl<C: Consistency, N: AsLen> Consistency for RepeatN<C, N>
Source§open spec fn consistent(&self, vs: Self::Val) -> bool
open spec fn consistent(&self, vs: Self::Val) -> bool
{
&&& vs.len() == self.0.as_nat()
&&& super::Star(self.1).consistent(vs)
}Source§type Val = Seq<<C as Consistency>::Val>
type Val = Seq<<C as Consistency>::Val>
The type of values whose consistency is being checked.
Source§impl<C: EquivSerializersGeneral, N: AsLen> EquivSerializers for RepeatN<C, N>
impl<C: EquivSerializersGeneral, N: AsLen> EquivSerializers for RepeatN<C, N>
Source§impl<C: EquivSerializersGeneral, N: AsLen> EquivSerializersGeneral for RepeatN<C, N>
impl<C: EquivSerializersGeneral, N: AsLen> EquivSerializersGeneral for RepeatN<C, N>
Source§open spec fn equiv_general_inv(&self) -> bool
open spec fn equiv_general_inv(&self) -> bool
{ 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<C: GoodSerializer, N: AsLen> GoodSerializer for RepeatN<C, N>
impl<C: GoodSerializer, N: AsLen> GoodSerializer for RepeatN<C, N>
Source§open spec fn serialize_inv(&self) -> bool
open spec fn serialize_inv(&self) -> bool
{ 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<C: MinMaxByteLen, N: AsLen> MinMaxByteLen for RepeatN<C, N>
impl<C: MinMaxByteLen, N: AsLen> MinMaxByteLen for RepeatN<C, N>
Source§impl<C: NoLookAhead, N: AsLen> NoLookAhead for RepeatN<C, N>
impl<C: NoLookAhead, N: AsLen> NoLookAhead for RepeatN<C, N>
Source§open spec fn no_lookahead_inv(&self) -> bool
open spec fn no_lookahead_inv(&self) -> bool
{ 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<C: NonMalleable + SafeParser, N: AsLen> NonMalleable for RepeatN<C, N>
impl<C: NonMalleable + SafeParser, N: AsLen> NonMalleable for RepeatN<C, N>
Source§open spec fn nonmal_inv(&self) -> bool
open spec fn nonmal_inv(&self) -> bool
{
&&& 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<C: NonTailFmt, N: AsLen> NonTailFmt for RepeatN<C, N>
impl<C: NonTailFmt, N: AsLen> NonTailFmt for RepeatN<C, N>
Source§open spec fn serialize_dps_inv(&self) -> bool
open spec fn serialize_dps_inv(&self) -> bool
{ 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<C: Productive, N: AsLen> Productive for RepeatN<C, N>
impl<C: Productive, N: AsLen> Productive for RepeatN<C, N>
Source§open spec fn productive_inv(&self) -> bool
open spec fn productive_inv(&self) -> bool
{
&&& self.0.as_nat() > 0
&&& self.1.productive_inv()
}Source§proof fn lemma_productive(&self, s: Seq<u8>)
proof fn lemma_productive(&self, s: Seq<u8>)
Source§impl<C, N> SPRoundTripDps for RepeatN<C, N>
impl<C, N> SPRoundTripDps for RepeatN<C, N>
Source§open spec fn unambiguous(&self) -> bool
open spec fn unambiguous(&self) -> bool
{
&&& self.1.serialize_dps_inv()
&&& 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<C: SafeParser, N: AsLen> SafeParser for RepeatN<C, N>
impl<C: SafeParser, N: AsLen> SafeParser for RepeatN<C, N>
Source§impl<Output: OutputBuf, Inner, N, T> Serializer<Output, [T]> for RepeatN<Inner, N>where
T: DeepView,
Inner: Serializer<Output, T>,
N: AsLen,
impl<Output: OutputBuf, Inner, N, T> Serializer<Output, [T]> for RepeatN<Inner, N>where
T: DeepView,
Inner: Serializer<Output, T>,
N: AsLen,
Source§exec fn serialize_into(&self, v: &[T], obuf: &mut Output)
exec fn serialize_into(&self, v: &[T], obuf: &mut Output)
Source§impl<C: SoundParser, N: AsLen> SoundParser for RepeatN<C, N>
impl<C: SoundParser, N: AsLen> SoundParser for RepeatN<C, N>
Source§impl<C: SpecByteLen, N: AsLen> SpecByteLen for RepeatN<C, N>
impl<C: SpecByteLen, N: AsLen> SpecByteLen for RepeatN<C, N>
Source§impl<C: SpecParser, N: AsLen> SpecParser for RepeatN<C, N>
impl<C: SpecParser, N: AsLen> SpecParser for RepeatN<C, N>
Source§impl<C: SpecSerializer, N: AsLen> SpecSerializer for RepeatN<C, N>
impl<C: SpecSerializer, N: AsLen> SpecSerializer for RepeatN<C, N>
Source§open spec fn spec_serialize(&self, vs: Self::SVal) -> Seq<u8>
open spec fn spec_serialize(&self, vs: Self::SVal) -> Seq<u8>
{ spec_serialize_seq(&self.1, vs) }Source§type SVal = Seq<<C as SpecSerializer>::SVal>
type SVal = Seq<<C as SpecSerializer>::SVal>
The type of values to be serialized.
Source§impl<C: SpecSerializerDps, N: AsLen> SpecSerializerDps for RepeatN<C, N>
impl<C: SpecSerializerDps, N: AsLen> SpecSerializerDps for RepeatN<C, N>
Source§impl<C: ValueByteLen, N: AsLen> ValueByteLen for RepeatN<C, N>
impl<C: ValueByteLen, N: AsLen> ValueByteLen for RepeatN<C, N>
Source§open spec fn value_byte_len(vs: Self::T) -> nat
open spec fn value_byte_len(vs: Self::T) -> nat
{ <super::Star<C> as ValueByteLen>::value_byte_len(vs) }Source§proof fn lemma_value_len_matches_byte_len(&self, vs: Self::T)
proof fn lemma_value_len_matches_byte_len(&self, vs: Self::T)
impl<C: Copy, N: Copy> Copy for RepeatN<C, N>
Auto Trait Implementations§
impl<C, N> Freeze for RepeatN<C, N>
impl<C, N> RefUnwindSafe for RepeatN<C, N>where
N: RefUnwindSafe,
C: RefUnwindSafe,
impl<C, N> Send for RepeatN<C, N>
impl<C, N> Sync for RepeatN<C, N>
impl<C, N> Unpin for RepeatN<C, N>
impl<C, N> UnsafeUnpin for RepeatN<C, N>where
N: UnsafeUnpin,
C: UnsafeUnpin,
impl<C, N> UnwindSafe for RepeatN<C, N>where
N: UnwindSafe,
C: 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() }