Trait vstd::tokens::CountToken
source · pub trait CountToken: Sized {
// Required methods
spec fn instance_id(&self) -> InstanceId;
spec fn count(&self) -> nat;
proof fn join(tracked &mut self, tracked other: Self);
proof fn split(tracked &mut self, count: nat) -> tracked token : Self;
proof fn weaken_shared(tracked &self, count: nat) -> tracked s : &Self;
proof fn arbitrary() -> tracked s : Self;
}Expand description
Interface for VerusSync tokens created for a field marked with the count strategy.
| VerusSync Strategy | Field type | Token trait |
|---|---|---|
count | nat | CountToken |
These tokens are “fungible” in the sense that they can be combined and split, numbers combining additively.
(For the persistent_count strategy, see MonotonicCountToken.)
Required Methods§
sourcespec fn instance_id(&self) -> InstanceId
spec fn instance_id(&self) -> InstanceId
sourceproof fn join(tracked &mut self, tracked other: Self)
proof fn join(tracked &mut self, tracked other: Self)
requires
old(self).instance_id() == other.instance_id(),ensuresself.instance_id() == old(self).instance_id(),self.count() == old(self).count() + other.count(),sourceproof fn split(tracked &mut self, count: nat) -> tracked token : Self
proof fn split(tracked &mut self, count: nat) -> tracked token : Self
requires
count <= old(self).count(),ensuresself.instance_id() == old(self).instance_id(),self.count() == old(self).count() - count,token.instance_id() == old(self).instance_id(),token.count() == count,requires
count <= self.count(),ensuress.instance_id() == self.instance_id(),s.count() == count,Object Safety§
This trait is not object safe.