pub struct MapToken<Key, Value, Token>where
Token: KeyValueToken<Key, Value>,{ /* private fields */ }
Implementations§
source§impl<Key, Value, Token> MapToken<Key, Value, Token>where
Token: KeyValueToken<Key, Value>,
impl<Key, Value, Token> MapToken<Key, Value, Token>where
Token: KeyValueToken<Key, Value>,
sourcepub closed spec fn instance_id(self) -> InstanceId
pub closed spec fn instance_id(self) -> InstanceId
sourcepub open spec fn spec_index(self, k: Key) -> Value
pub open spec fn spec_index(self, k: Key) -> Value
{ self.map()[k] }
sourcepub proof fn empty(instance_id: InstanceId) -> tracked s : Self
pub proof fn empty(instance_id: InstanceId) -> tracked s : Self
ensures
s.instance_id() == instance_id,
s.map() === Map::empty(),
sourcepub proof fn insert(tracked &mut self, tracked token: Token)
pub proof fn insert(tracked &mut self, tracked token: Token)
requires
old(self).instance_id() == token.instance_id(),
ensuresself.instance_id() == old(self).instance_id(),
self.map() == old(self).map().insert(token.key(), token.value()),
sourcepub proof fn remove(tracked &mut self, key: Key) -> tracked token : Token
pub proof fn remove(tracked &mut self, key: Key) -> tracked token : Token
requires
old(self).map().dom().contains(key),
ensuresself.instance_id() == old(self).instance_id(),
self.map() == old(self).map().remove(key),
token.instance_id() == self.instance_id(),
token.key() == key,
token.value() == old(self).map()[key],
sourcepub proof fn into_map(tracked self) -> tracked map : Map<Key, Token>
pub proof fn into_map(tracked self) -> tracked map : Map<Key, Token>
ensures
map.dom() == self.map().dom(),
forall |key| {
map.dom().contains(key)
==> map[key].instance_id() == self.instance_id() && map[key].key() == key
&& map[key].value() == self.map()[key]
},
sourcepub proof fn from_map(instance_id: InstanceId, tracked map: Map<Key, Token>) -> tracked s : Self
pub proof fn from_map(instance_id: InstanceId, tracked map: Map<Key, Token>) -> tracked s : Self
requires
forall |key| #[trigger] map.dom().contains(key) ==> map[key].instance_id() == instance_id,
forall |key| #[trigger] map.dom().contains(key) ==> map[key].key() == key,
ensuress.instance_id() == instance_id,
s.map().dom() == map.dom(),
forall |key| #[trigger] map.dom().contains(key) ==> s.map()[key] == map[key].value(),
Auto Trait Implementations§
impl<Key, Value, Token> Freeze for MapToken<Key, Value, Token>
impl<Key, Value, Token> RefUnwindSafe for MapToken<Key, Value, Token>
impl<Key, Value, Token> Send for MapToken<Key, Value, Token>
impl<Key, Value, Token> Sync for MapToken<Key, Value, Token>
impl<Key, Value, Token> Unpin for MapToken<Key, Value, Token>
impl<Key, Value, Token> UnwindSafe for MapToken<Key, Value, Token>
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