Struct vstd::tokens::MapToken

source ·
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>,

source

pub closed spec fn instance_id(self) -> InstanceId

source

pub closed spec fn map(self) -> Map<Key, Value>

source

pub open spec fn dom(self) -> Set<Key>

{ self.map().dom() }
source

pub open spec fn spec_index(self, k: Key) -> Value

{ self.map()[k] }
source

pub open spec fn index(self, k: Key) -> Value

{ self.map()[k] }
source

pub proof fn empty(instance_id: InstanceId) -> tracked s : Self

ensures
s.instance_id() == instance_id,
s.map() === Map::empty(),
source

pub proof fn insert(tracked &mut self, tracked token: Token)

requires
old(self).instance_id() == token.instance_id(),
ensures
self.instance_id() == old(self).instance_id(),
self.map() == old(self).map().insert(token.key(), token.value()),
source

pub proof fn remove(tracked &mut self, key: Key) -> tracked token : Token

requires
old(self).map().dom().contains(key),
ensures
self.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],
source

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]
},
source

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,
ensures
s.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>
where Value: RefUnwindSafe, Key: RefUnwindSafe, Token: RefUnwindSafe,

§

impl<Key, Value, Token> Send for MapToken<Key, Value, Token>
where Value: Send, Key: Send, Token: Send,

§

impl<Key, Value, Token> Sync for MapToken<Key, Value, Token>
where Value: Sync, Key: Sync, Token: Sync,

§

impl<Key, Value, Token> Unpin for MapToken<Key, Value, Token>
where Value: Unpin, Key: Unpin, Token: Unpin,

§

impl<Key, Value, Token> UnwindSafe for MapToken<Key, Value, Token>
where Value: UnwindSafe, Key: UnwindSafe, Token: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.