Trait vstd::tokens::KeyValueToken

source ·
pub trait KeyValueToken<Key, Value>: Sized {
    // Required methods
    spec fn instance_id(&self) -> InstanceId;
    spec fn key(&self) -> Key;
    spec fn value(&self) -> Value;
    proof fn agree(tracked &self, tracked other: &Self);
    proof fn arbitrary() -> tracked s : Self;
}
Expand description

Interface for VerusSync tokens created for a field marked with the map or persistent_map strategies.

VerusSync StrategyField typeToken trait
mapMap<K, V>UniqueKeyValueToken<K, V>
persistent_mapMap<K, V>KeyValueToken<V> + Copy

For the cases where the tokens are not Copy, then token is necessarily unique per-instance, per-key; the sub-trait, UniqueKeyValueToken<V>, provides an additional lemma to prove uniqueness.

Each token represents a single key-value pair. To work with a collection of KeyValueTokens, use MapToken.

Required Methods§

source

spec fn instance_id(&self) -> InstanceId

source

spec fn key(&self) -> Key

source

spec fn value(&self) -> Value

source

proof fn agree(tracked &self, tracked other: &Self)

requires
self.instance_id() == other.instance_id(),
self.key() == other.key(),
ensures
self.value() == other.value(),

All tokens, for the same instance and key, must agree on the value.

source

proof fn arbitrary() -> tracked s : Self

Return an arbitrary token. It’s not possible to do anything interesting with this token because it doesn’t have a specified instance.

Object Safety§

This trait is not object safe.

Implementors§