pub struct FnByteLen<T: DeepView + ?Sized, Spec: SpecByteLen<T = T::V> + Consistency<Val = T::V>, Exec: Fn(&T) -> usize> {
pub exec_fn: Exec,
pub spec_fn: Ghost<Spec>,
pub _marker: PhantomData<T>,
}Expand description
Pairs an executable byte-length closure with its specification.
Fields§
§exec_fn: Exec§spec_fn: Ghost<Spec>§_marker: PhantomData<T>Implementations§
Source§impl<T, Spec, Exec> FnByteLen<T, Spec, Exec>where
T: DeepView + ?Sized,
Spec: SpecByteLen<T = T::V> + Consistency<Val = T::V>,
Exec: Fn(&T) -> usize,
impl<T, Spec, Exec> FnByteLen<T, Spec, Exec>where
T: DeepView + ?Sized,
Spec: SpecByteLen<T = T::V> + Consistency<Val = T::V>,
Exec: Fn(&T) -> usize,
Sourcepub exec fn new(exec_fn: Exec, Ghost(spec_fn): Ghost<Spec>) -> length : Self
pub exec fn new(exec_fn: Exec, Ghost(spec_fn): Ghost<Spec>) -> length : Self
requires
forall |value: &T| {
spec_fn.byte_len(value.deep_view()) <= usize::MAX ==> #[trigger]
call_requires(exec_fn, (value,))
},forall |value: &T, len: usize| {
#[trigger] call_ensures(exec_fn, (value,), len)
==> len == spec_fn.byte_len(value.deep_view())
},ensureslength.exec_inv(),length.spec_fn == spec_fn,Trait Implementations§
Source§impl<T, Spec, Exec> ByteLen<T> for FnByteLen<T, Spec, Exec>where
T: DeepView + ?Sized,
Spec: SpecByteLen<T = T::V> + Consistency<Val = T::V>,
Exec: Fn(&T) -> usize,
impl<T, Spec, Exec> ByteLen<T> for FnByteLen<T, Spec, Exec>where
T: DeepView + ?Sized,
Spec: SpecByteLen<T = T::V> + Consistency<Val = T::V>,
Exec: Fn(&T) -> usize,
Source§open spec fn exec_inv(&self) -> bool
open spec fn exec_inv(&self) -> bool
{
&&& forall |value: &T| (
self.spec_fn@.byte_len(value.deep_view()) <= usize::MAX ==> #[trigger]
call_requires(self.exec_fn, (value,))
)
&&& forall |value: &T, len: usize| {
#[trigger] call_ensures(self.exec_fn, (value,), len)
==> len == self.spec_fn@.byte_len(value.deep_view())
}
}Source§impl<T, Spec, Exec> Consistency for FnByteLen<T, Spec, Exec>where
T: DeepView + ?Sized,
Spec: SpecByteLen<T = T::V> + Consistency<Val = T::V>,
Exec: Fn(&T) -> usize,
impl<T, Spec, Exec> Consistency for FnByteLen<T, Spec, Exec>where
T: DeepView + ?Sized,
Spec: SpecByteLen<T = T::V> + Consistency<Val = T::V>,
Exec: Fn(&T) -> usize,
Source§impl<T, Spec, Exec> SpecByteLen for FnByteLen<T, Spec, Exec>where
T: DeepView + ?Sized,
Spec: SpecByteLen<T = T::V> + Consistency<Val = T::V>,
Exec: Fn(&T) -> usize,
impl<T, Spec, Exec> SpecByteLen for FnByteLen<T, Spec, Exec>where
T: DeepView + ?Sized,
Spec: SpecByteLen<T = T::V> + Consistency<Val = T::V>,
Exec: Fn(&T) -> usize,
Auto Trait Implementations§
impl<T, Spec, Exec> Freeze for FnByteLen<T, Spec, Exec>
impl<T, Spec, Exec> RefUnwindSafe for FnByteLen<T, Spec, Exec>
impl<T, Spec, Exec> Send for FnByteLen<T, Spec, Exec>
impl<T, Spec, Exec> Sync for FnByteLen<T, Spec, Exec>
impl<T, Spec, Exec> Unpin for FnByteLen<T, Spec, Exec>
impl<T, Spec, Exec> UnsafeUnpin for FnByteLen<T, Spec, Exec>where
Exec: UnsafeUnpin,
T: ?Sized,
impl<T, Spec, Exec> UnwindSafe for FnByteLen<T, Spec, Exec>
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