pub struct Preceded<Fst, Snd>(pub Fst, pub Snd);Expand description
Combinator that sequentially applies two combinators and returns the result of the second one.
Tuple Fields§
§0: Fst§1: SndTrait Implementations§
Source§impl<'x, I, O, Fst, Snd> Combinator<'x, I, O> for Preceded<Fst, Snd>where
I: VestInput,
O: VestOutput<I>,
Fst: Combinator<'x, I, O, Type = (), SType = ()>,
Snd: Combinator<'x, I, O>,
Fst::V: SecureSpecCombinator<Type = ()>,
Snd::V: SecureSpecCombinator<Type = <Snd::Type as View>::V>,
impl<'x, I, O, Fst, Snd> Combinator<'x, I, O> for Preceded<Fst, Snd>where
I: VestInput,
O: VestOutput<I>,
Fst: Combinator<'x, I, O, Type = (), SType = ()>,
Snd: Combinator<'x, I, O>,
Fst::V: SecureSpecCombinator<Type = ()>,
Snd::V: SecureSpecCombinator<Type = <Snd::Type as View>::V>,
Source§open spec fn ex_requires(&self) -> bool
open spec fn ex_requires(&self) -> bool
{ (&self.0, &self.1).ex_requires() }Source§exec fn serialize<'b>(
&self,
v: Self::SType,
data: &'b mut O,
pos: usize,
) -> Result<usize, SerializeError>
exec fn serialize<'b>( &self, v: Self::SType, data: &'b mut O, pos: usize, ) -> Result<usize, SerializeError>
Source§type Type = <Snd as Combinator<'x, I, O>>::Type
type Type = <Snd as Combinator<'x, I, O>>::Type
The result type of parsing
Source§type SType = <Snd as Combinator<'x, I, O>>::SType
type SType = <Snd as Combinator<'x, I, O>>::SType
The input type of serialization, often a reference to
Self::Type.
For “structural” formats though (e.g., crate::regular::sequence::Pair and crate::regular::variant::Choice),
this is the tuple/sum of the corresponding Combinator::SType types.Source§impl<U1, U2, V1, V2> DisjointFrom<Preceded<U2, V2>> for Preceded<U1, V1>where
U1: DisjointFrom<U2> + SecureSpecCombinator<Type = ()>,
U2: SecureSpecCombinator<Type = ()>,
V1: SpecCombinator,
V2: SpecCombinator,
impl<U1, U2, V1, V2> DisjointFrom<Preceded<U2, V2>> for Preceded<U1, V1>where
U1: DisjointFrom<U2> + SecureSpecCombinator<Type = ()>,
U2: SecureSpecCombinator<Type = ()>,
V1: SpecCombinator,
V2: SpecCombinator,
Source§open spec fn disjoint_from(&self, other: &Preceded<U2, V2>) -> bool
open spec fn disjoint_from(&self, other: &Preceded<U2, V2>) -> bool
{ self.0.disjoint_from(&other.0) }Source§proof fn parse_disjoint_on(&self, other: &Preceded<U2, V2>, buf: Seq<u8>)
proof fn parse_disjoint_on(&self, other: &Preceded<U2, V2>, buf: Seq<u8>)
Source§impl<Fst: SecureSpecCombinator<Type = ()>, Snd: SecureSpecCombinator> SecureSpecCombinator for Preceded<Fst, Snd>
impl<Fst: SecureSpecCombinator<Type = ()>, Snd: SecureSpecCombinator> SecureSpecCombinator for Preceded<Fst, Snd>
Source§proof fn theorem_serialize_parse_roundtrip(&self, v: Self::Type)
proof fn theorem_serialize_parse_roundtrip(&self, v: Self::Type)
Source§proof fn theorem_parse_serialize_roundtrip(&self, buf: Seq<u8>)
proof fn theorem_parse_serialize_roundtrip(&self, buf: Seq<u8>)
Source§open spec fn is_prefix_secure() -> bool
open spec fn is_prefix_secure() -> bool
{ Fst::is_prefix_secure() && Snd::is_prefix_secure() }Source§proof fn lemma_prefix_secure(&self, s1: Seq<u8>, s2: Seq<u8>)
proof fn lemma_prefix_secure(&self, s1: Seq<u8>, s2: Seq<u8>)
Source§proof fn lemma_parse_length(&self, s: Seq<u8>)
proof fn lemma_parse_length(&self, s: Seq<u8>)
Source§open spec fn is_productive(&self) -> bool
open spec fn is_productive(&self) -> bool
{ (self.0, self.1).is_productive() }Source§proof fn lemma_parse_productive(&self, s: Seq<u8>)
proof fn lemma_parse_productive(&self, s: Seq<u8>)
Source§fn corollary_parse_surjective(&self, v: Self::Type)
fn corollary_parse_surjective(&self, v: Self::Type)
Source§fn corollary_serialize_injective_contraposition(
&self,
v1: Self::Type,
v2: Self::Type,
)
fn corollary_serialize_injective_contraposition( &self, v1: Self::Type, v2: Self::Type, )
Source§fn lemma_serialize_productive(&self, v: Self::Type)
fn lemma_serialize_productive(&self, v: Self::Type)
Source§impl<Fst: SecureSpecCombinator<Type = ()>, Snd: SpecCombinator> SpecCombinator for Preceded<Fst, Snd>
impl<Fst: SecureSpecCombinator<Type = ()>, Snd: SpecCombinator> SpecCombinator for Preceded<Fst, Snd>
Source§open spec fn spec_parse(&self, s: Seq<u8>) -> Option<(int, Self::Type)>
open spec fn spec_parse(&self, s: Seq<u8>) -> Option<(int, Self::Type)>
{
if let Some((n, ((), v))) = (self.0, self.1).spec_parse(s) {
Some((n, v))
} else {
None
}
}Source§open spec fn spec_serialize(&self, v: Self::Type) -> Seq<u8>
open spec fn spec_serialize(&self, v: Self::Type) -> Seq<u8>
{ (self.0, self.1).spec_serialize(((), v)) }Source§type Type = <Snd as SpecCombinator>::Type
type Type = <Snd as SpecCombinator>::Type
The view of [
Combinator::Result].Auto Trait Implementations§
impl<Fst, Snd> Freeze for Preceded<Fst, Snd>
impl<Fst, Snd> RefUnwindSafe for Preceded<Fst, Snd>where
Fst: RefUnwindSafe,
Snd: RefUnwindSafe,
impl<Fst, Snd> Send for Preceded<Fst, Snd>
impl<Fst, Snd> Sync for Preceded<Fst, Snd>
impl<Fst, Snd> Unpin for Preceded<Fst, Snd>
impl<Fst, Snd> UnwindSafe for Preceded<Fst, Snd>where
Fst: UnwindSafe,
Snd: 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
§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<T, U> SpecTryInto<U> for Twhere
U: SpecTryFrom<T>,
impl<T, U> SpecTryInto<U> for Twhere
U: SpecTryFrom<T>,
Source§open spec fn spec_try_into(self) -> Result<U, <U as SpecTryFrom<T>>::Error>
open spec fn spec_try_into(self) -> Result<U, <U as SpecTryFrom<T>>::Error>
{ U::spec_try_from(self) }Source§type Error = <U as SpecTryFrom<T>>::Error
type Error = <U as SpecTryFrom<T>>::Error
The type returned in the event of a conversion error.