pub struct Pair<Fst, Snd, Cont> {
pub fst: Fst,
pub _snd: PhantomData<Snd>,
pub snd: Cont,
}Expand description
Combinator that sequentially applies two combinators, where the second combinator depends on the first one.
Fields§
§fst: Fstcombinators that contain dependencies
_snd: PhantomData<Snd>phantom data representing the second combinator (it really should be private, but this is a workaround for Verus’s conservative treatment of opaque types, which doesn’t allow field access of opaque types in open spec functions)
snd: Contclosure that captures dependencies and maps them to the dependent combinators
Implementations§
Source§impl<Fst, Snd, Cont> Pair<Fst, Snd, Cont>where
Fst: View,
Snd: View,
Cont: View<V = GhostFn<<Fst::V as SpecCombinator>::Type, Snd::V>>,
Fst::V: SecureSpecCombinator,
Snd::V: SpecCombinator,
impl<Fst, Snd, Cont> Pair<Fst, Snd, Cont>where
Fst: View,
Snd: View,
Cont: View<V = GhostFn<<Fst::V as SpecCombinator>::Type, Snd::V>>,
Fst::V: SecureSpecCombinator,
Snd::V: SpecCombinator,
Trait Implementations§
Source§impl<'x, I, O, Fst, Snd, Cont> Combinator<'x, I, O> for Pair<Fst, Snd, Cont>where
I: VestInput,
O: VestOutput<I>,
Fst: Combinator<'x, I, O>,
Snd: Combinator<'x, I, O>,
Fst::V: SecureSpecCombinator<Type = <Fst::Type as View>::V>,
Snd::V: SecureSpecCombinator<Type = <Snd::Type as View>::V>,
Fst::SType: Copy,
Cont: for<'a> Continuation<POrSType<&'a Fst::Type, Fst::SType>, Output = Snd> + View<V = GhostFn<<Fst::Type as View>::V, Snd::V>>,
<Fst as Combinator<'x, I, O>>::Type: 'x,
impl<'x, I, O, Fst, Snd, Cont> Combinator<'x, I, O> for Pair<Fst, Snd, Cont>where
I: VestInput,
O: VestOutput<I>,
Fst: Combinator<'x, I, O>,
Snd: Combinator<'x, I, O>,
Fst::V: SecureSpecCombinator<Type = <Fst::Type as View>::V>,
Snd::V: SecureSpecCombinator<Type = <Snd::Type as View>::V>,
Fst::SType: Copy,
Cont: for<'a> Continuation<POrSType<&'a Fst::Type, Fst::SType>, Output = Snd> + View<V = GhostFn<<Fst::Type as View>::V, Snd::V>>,
<Fst as Combinator<'x, I, O>>::Type: 'x,
Source§open spec fn ex_requires(&self) -> bool
open spec fn ex_requires(&self) -> bool
{
let spec_snd_dep = self.snd@;
&&& self.fst.ex_requires()
&&& forall |i| #[trigger] self.snd.requires(i)
&&& forall |i, snd| {
#[trigger] self.snd.ensures(i, snd)
==> snd.ex_requires() && snd@ == spec_snd_dep(i@)
}
}Source§exec fn serialize(
&self,
v: Self::SType,
data: &mut O,
pos: usize,
) -> res : Result<usize, SerializeError>
exec fn serialize( &self, v: Self::SType, data: &mut O, pos: usize, ) -> res : Result<usize, SerializeError>
Source§type Type = (<Fst as Combinator<'x, I, O>>::Type, <Snd as Combinator<'x, I, O>>::Type)
type Type = (<Fst as Combinator<'x, I, O>>::Type, <Snd as Combinator<'x, I, O>>::Type)
The result type of parsing
Source§type SType = (<Fst as Combinator<'x, I, O>>::SType, <Snd as Combinator<'x, I, O>>::SType)
type SType = (<Fst as Combinator<'x, I, O>>::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<Pair<U2, V2, FnSpec<(<U2 as SpecCombinator>::Type,), V2>>> for SpecPair<U1, V1>where
U1: DisjointFrom<U2> + SecureSpecCombinator,
U2: SecureSpecCombinator,
V1: SpecCombinator,
V2: SpecCombinator,
impl<U1, U2, V1, V2> DisjointFrom<Pair<U2, V2, FnSpec<(<U2 as SpecCombinator>::Type,), V2>>> for SpecPair<U1, V1>where
U1: DisjointFrom<U2> + SecureSpecCombinator,
U2: SecureSpecCombinator,
V1: SpecCombinator,
V2: SpecCombinator,
Source§open spec fn disjoint_from(&self, other: &SpecPair<U2, V2>) -> bool
open spec fn disjoint_from(&self, other: &SpecPair<U2, V2>) -> bool
{ self.fst.disjoint_from(&other.fst) }Source§proof fn parse_disjoint_on(&self, other: &SpecPair<U2, V2>, buf: Seq<u8>)
proof fn parse_disjoint_on(&self, other: &SpecPair<U2, V2>, buf: Seq<u8>)
Source§impl<Fst, Snd, Cont> View for Pair<Fst, Snd, Cont>where
Fst: View,
Snd: View,
Cont: View<V = GhostFn<<Fst::V as SpecCombinator>::Type, Snd::V>>,
Fst::V: SecureSpecCombinator,
Snd::V: SpecCombinator,
impl<Fst, Snd, Cont> View for Pair<Fst, Snd, Cont>where
Fst: View,
Snd: View,
Cont: View<V = GhostFn<<Fst::V as SpecCombinator>::Type, Snd::V>>,
Fst::V: SecureSpecCombinator,
Snd::V: SpecCombinator,
Auto Trait Implementations§
impl<Fst, Snd, Cont> Freeze for Pair<Fst, Snd, Cont>
impl<Fst, Snd, Cont> RefUnwindSafe for Pair<Fst, Snd, Cont>
impl<Fst, Snd, Cont> Send for Pair<Fst, Snd, Cont>
impl<Fst, Snd, Cont> Sync for Pair<Fst, Snd, Cont>
impl<Fst, Snd, Cont> Unpin for Pair<Fst, Snd, Cont>
impl<Fst, Snd, Cont> UnwindSafe for Pair<Fst, Snd, Cont>
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.