pub struct Refined<Inner, Predicate>(pub Inner, pub Predicate);Expand description
Value refinement combinator: filters values through a predicate.
§Consistency
inner.consistent(v) && predicate.apply(v).
Tuple Fields§
§0: Inner§1: PredicateTrait Implementations§
Source§impl<A, Pred> Consistency for Refined<A, Pred>
impl<A, Pred> Consistency for Refined<A, Pred>
Source§open spec fn consistent(&self, v: Self::Val) -> bool
open spec fn consistent(&self, v: Self::Val) -> bool
{ self.0.consistent(v) && self.1.apply(v) }Source§type Val = <A as Consistency>::Val
type Val = <A as Consistency>::Val
The type of values whose consistency is being checked.
Source§impl<Inner, P, T> DerOrd<T> for Refined<Inner, P>
impl<Inner, P, T> DerOrd<T> for Refined<Inner, P>
Source§proof fn lemma_der_serialize_len(&self, value: T::V)
proof fn lemma_der_serialize_len(&self, value: T::V)
Source§open spec fn der_remaining(&self, value: T::V, state: Inner::State) -> Seq<u8>
open spec fn der_remaining(&self, value: T::V, state: Inner::State) -> Seq<u8>
{ self.0.der_remaining(value, state) }Source§open spec fn der_state_valid(&self, value: T::V, state: Inner::State) -> bool
open spec fn der_state_valid(&self, value: T::V, state: Inner::State) -> bool
{ self.0.der_state_valid(value, state) }Source§impl<A, Pred> EquivSerializers for Refined<A, Pred>
impl<A, Pred> EquivSerializers for Refined<A, Pred>
Source§impl<A, Pred> EquivSerializersGeneral for Refined<A, Pred>
impl<A, Pred> EquivSerializersGeneral for Refined<A, Pred>
Source§open spec fn equiv_general_inv(&self) -> bool
open spec fn equiv_general_inv(&self) -> bool
{ self.0.equiv_general_inv() }Source§proof fn lemma_serialize_equiv(&self, v: Self::SValue, obuf: Seq<u8>)
proof fn lemma_serialize_equiv(&self, v: Self::SValue, obuf: Seq<u8>)
Source§impl<A, Pred> GoodSerializer for Refined<A, Pred>
impl<A, Pred> GoodSerializer for Refined<A, Pred>
Source§open spec fn serialize_inv(&self) -> bool
open spec fn serialize_inv(&self) -> bool
{ self.0.serialize_inv() }Source§proof fn lemma_serialize_len(&self, v: Self::SVal)
proof fn lemma_serialize_len(&self, v: Self::SVal)
Source§impl<Inner: HasAsn1Start, Predicate: SpecPred<Inner::PVal>> HasAsn1Start for Refined<Inner, Predicate>
Refinement can only narrow an accepted input domain.
impl<Inner: HasAsn1Start, Predicate: SpecPred<Inner::PVal>> HasAsn1Start for Refined<Inner, Predicate>
Refinement can only narrow an accepted input domain.
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, Pred> MinMaxByteLen for Refined<A, Pred>
impl<A, Pred> MinMaxByteLen for Refined<A, Pred>
Source§impl<A: NoLookAhead, Pred: SpecPred<A::PVal>> NoLookAhead for Refined<A, Pred>
impl<A: NoLookAhead, Pred: SpecPred<A::PVal>> NoLookAhead for Refined<A, Pred>
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: NonMalleable, Pred: SpecPred<A::PVal>> NonMalleable for Refined<A, Pred>
impl<A: NonMalleable, Pred: SpecPred<A::PVal>> NonMalleable for Refined<A, Pred>
Source§open spec fn nonmal_inv(&self) -> bool
open spec fn nonmal_inv(&self) -> bool
{ self.0.nonmal_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, Pred> NonTailFmt for Refined<A, Pred>
impl<A, Pred> NonTailFmt for Refined<A, Pred>
Source§open spec fn serialize_dps_inv(&self) -> bool
open spec fn serialize_dps_inv(&self) -> bool
{ self.0.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, Pred: SpecPred<A::PVal>> Productive for Refined<A, Pred>
impl<A: Productive, Pred: SpecPred<A::PVal>> Productive for Refined<A, Pred>
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<F, P> Retaggable for Refined<F, P>where
F: Retaggable,
P: Copy,
Allows a value constraint to remain attached when its underlying ASN.1 format is retagged.
impl<F, P> Retaggable for Refined<F, P>where
F: Retaggable,
P: Copy,
Allows a value constraint to remain attached when its underlying ASN.1 format is retagged.
Retagging is delegated to the inner format and the refinement predicate is preserved.
Source§impl<A, Pred> SPRoundTripDps for Refined<A, Pred>
impl<A, Pred> SPRoundTripDps for Refined<A, Pred>
Source§open spec fn unambiguous(&self) -> bool
open spec fn unambiguous(&self) -> bool
{ self.0.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, Pred> SafeParser for Refined<A, Pred>
impl<A, Pred> SafeParser for Refined<A, Pred>
Source§impl<Output: OutputBuf, A, PredFn, T> Serializer<Output, T> for Refined<A, PredFn>where
T: DeepView,
A: Serializer<Output, T>,
PredFn: SpecPred<T::V>,
impl<Output: OutputBuf, A, PredFn, T> Serializer<Output, T> for Refined<A, PredFn>where
T: DeepView,
A: Serializer<Output, T>,
PredFn: SpecPred<T::V>,
Source§exec fn serialize_into(&self, v: &T, obuf: &mut Output)
exec fn serialize_into(&self, v: &T, obuf: &mut Output)
Source§impl<A, Pred> SoundParser for Refined<A, Pred>
impl<A, Pred> SoundParser for Refined<A, Pred>
Source§impl<A, Pred> SpecByteLen for Refined<A, Pred>
impl<A, Pred> SpecByteLen for Refined<A, Pred>
Source§impl<A, Pred> SpecParser for Refined<A, Pred>
impl<A, Pred> SpecParser for Refined<A, Pred>
Source§impl<A, Pred> SpecSerializer for Refined<A, Pred>
impl<A, Pred> SpecSerializer for Refined<A, Pred>
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) }Source§type SVal = <A as SpecSerializer>::SVal
type SVal = <A as SpecSerializer>::SVal
The type of values to be serialized.
Source§impl<A, Pred> SpecSerializerDps for Refined<A, Pred>
impl<A, Pred> SpecSerializerDps for Refined<A, Pred>
Source§impl<A, Pred> StaticByteLen for Refined<A, Pred>
impl<A, Pred> StaticByteLen for Refined<A, Pred>
Source§open spec fn static_byte_len() -> nat
open spec fn static_byte_len() -> nat
{ A::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, Pred> ValueByteLen for Refined<A, Pred>
impl<A, Pred> ValueByteLen for Refined<A, Pred>
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) }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<Inner: Copy, Predicate: Copy> Copy for Refined<Inner, Predicate>
Auto Trait Implementations§
impl<Inner, Predicate> Freeze for Refined<Inner, Predicate>
impl<Inner, Predicate> RefUnwindSafe for Refined<Inner, Predicate>where
Inner: RefUnwindSafe,
Predicate: RefUnwindSafe,
impl<Inner, Predicate> Send for Refined<Inner, Predicate>
impl<Inner, Predicate> Sync for Refined<Inner, Predicate>
impl<Inner, Predicate> Unpin for Refined<Inner, Predicate>
impl<Inner, Predicate> UnsafeUnpin for Refined<Inner, Predicate>where
Inner: UnsafeUnpin,
Predicate: UnsafeUnpin,
impl<Inner, Predicate> UnwindSafe for Refined<Inner, Predicate>where
Inner: UnwindSafe,
Predicate: 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() }