Struct vstd::tokens::SetToken

source ·
pub struct SetToken<Element, Token>
where Token: ElementToken<Element>,
{ /* private fields */ }

Implementations§

source§

impl<Element, Token> SetToken<Element, Token>
where Token: ElementToken<Element>,

source

pub closed spec fn instance_id(self) -> InstanceId

source

pub closed spec fn set(self) -> Set<Element>

source

pub open spec fn contains(self, element: Element) -> bool

{ self.set().contains(element) }
source

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

ensures
s.instance_id() == instance_id,
s.set() === Set::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.set() == old(self).set().insert(token.element()),
source

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

requires
old(self).set().contains(element),
ensures
self.instance_id() == old(self).instance_id(),
self.set() == old(self).set().remove(element),
token.instance_id() == self.instance_id(),
token.element() == element,
source

pub proof fn into_map(tracked self) -> tracked map : Map<Element, Token>

ensures
map.dom() == self.set(),
forall |key| {
    map.dom().contains(key)
        ==> map[key].instance_id() == self.instance_id() && map[key].element() == key
},
source

pub proof fn from_map(instance_id: InstanceId, tracked map: Map<Element, 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].element() == key,
ensures
s.instance_id() == instance_id,
s.set() == map.dom(),

Auto Trait Implementations§

§

impl<Element, Token> Freeze for SetToken<Element, Token>

§

impl<Element, Token> RefUnwindSafe for SetToken<Element, Token>
where Element: RefUnwindSafe, Token: RefUnwindSafe,

§

impl<Element, Token> Send for SetToken<Element, Token>
where Element: Send, Token: Send,

§

impl<Element, Token> Sync for SetToken<Element, Token>
where Element: Sync, Token: Sync,

§

impl<Element, Token> Unpin for SetToken<Element, Token>
where Element: Unpin, Token: Unpin,

§

impl<Element, Token> UnwindSafe for SetToken<Element, Token>
where Element: 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.