Struct creusot_contracts::logic::Mapping
source · pub struct Mapping<A: ?Sized, B: ?Sized>(/* private fields */);
Expand description
A mapping: map every value of type A
to a value of type B
.
§Pearlite syntax
Mappings have special support in pearlite code: you may write a closure to create a mapping.
§Example
let value = snapshot!(4);
let map: Snapshot<Mapping<Int, Int>> = snapshot!(|n| if n % 2 == 0 { 0 } else { *value });
proof_assert!(map.get(1) == 4);
Implementations§
Trait Implementations§
source§impl<A: ?Sized, B> IndexLogic<A> for Mapping<A, B>
impl<A: ?Sized, B> IndexLogic<A> for Mapping<A, B>
source§fn index_logic(self, a: A) -> B
fn index_logic(self, a: A) -> B
logic
self.get(a)
type Item = B
Auto Trait Implementations§
impl<A, B> Freeze for Mapping<A, B>
impl<A, B> !RefUnwindSafe for Mapping<A, B>
impl<A, B> !Send for Mapping<A, B>
impl<A, B> !Sync for Mapping<A, B>
impl<A, B> !Unpin for Mapping<A, B>
impl<A, B> !UnwindSafe for Mapping<A, B>
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> MakeSized for Twhere
T: ?Sized,
impl<T> MakeSized for Twhere
T: ?Sized,
source§fn make_sized(&self) -> Box<T>
fn make_sized(&self) -> Box<T>
logic ⚠
ensures
*result == *self