pub struct GhostPersistentSingleton<T> { /* private fields */ }Expand description
A resource that asserts duplicable client knowledge of a persistent singleton
For the authoritative resource of the whole set, see GhostSetAuth
Implementations§
Source§impl<T> GhostPersistentSingleton<T>
impl<T> GhostPersistentSingleton<T>
Sourcepub proof fn duplicate(tracked &mut self) -> tracked result : GhostPersistentSingleton<T>
pub proof fn duplicate(tracked &mut self) -> tracked result : GhostPersistentSingleton<T>
self.id() == result.id(),old(self).id() == self.id(),old(self)@ == self@,result@ == self@,Duplicate the GhostPersistentSingleton
Sourcepub proof fn agree(tracked self: &GhostPersistentSingleton<T>, tracked auth: &GhostSetAuth<T>)
pub proof fn agree(tracked self: &GhostPersistentSingleton<T>, tracked auth: &GhostSetAuth<T>)
self.id() == auth.id(),ensuresauth@.contains(self@),Agreement between a GhostPersistentSingleton and a corresponding GhostSetAuth
Verus might not have full context of the GhostSetAuth and a corresponding GhostPersistentSingleton.
However, whenever we know that they refer to the same resource (i.e., have matching ids) we
can assert that the GhostPersistentSingleton is a subset of the GhostSetAuth.
proof fn test(tracked &auth: GhostSetAuth<int>, tracked &pt: GhostPersistentSingleton<int>)
requires
auth.id() == sub.id(),
pt@ == 1int
ensures
auth@.contains(1int)
{
pt.agree(auth);
assert(auth@.contains(1int));
}Sourcepub proof fn combine(tracked
self,
tracked other: GhostPersistentSingleton<T>,
) -> tracked r : GhostPersistentSubset<T>
pub proof fn combine(tracked self, tracked other: GhostPersistentSingleton<T>, ) -> tracked r : GhostPersistentSubset<T>
self.id() == other.id(),ensuresr.id() == self.id(),r@ == set![self @, other @],self@ != other@ ==> r@.len() == 2,self@ == other@ ==> r@.len() == 1,We can combine two GhostPersistentSingletons into a GhostPersistentSubset
Sourcepub proof fn disjoint(tracked &mut self, tracked other: &GhostSingleton<T>)
pub proof fn disjoint(tracked &mut self, tracked other: &GhostSingleton<T>)
old(self).id() == other.id(),ensuresself.id() == old(self).id(),self@ == old(self)@,self@ != other@,Shows that a GhostPersistentSingleton and a GhostSingleton are not owning the same value
Sourcepub proof fn disjoint_subset(tracked &mut self, tracked other: &GhostSubset<T>)
pub proof fn disjoint_subset(tracked &mut self, tracked other: &GhostSubset<T>)
old(self).id() == other.id(),ensuresself.id() == old(self).id(),self@ == old(self)@,!other@.contains(self@),Shows that if a GhostPersistentSingleton and a GhostSubset are not owning the same value
Sourcepub proof fn subset(tracked self) -> tracked r : GhostPersistentSubset<T>
pub proof fn subset(tracked self) -> tracked r : GhostPersistentSubset<T>
r.id() == self.id(),r@ == set![self @],Convert the GhostPersistentSingleton a GhostPersistentSubset
Auto Trait Implementations§
impl<T> Freeze for GhostPersistentSingleton<T>
impl<T> RefUnwindSafe for GhostPersistentSingleton<T>where
T: RefUnwindSafe,
impl<T> Send for GhostPersistentSingleton<T>where
T: Send,
impl<T> Sync for GhostPersistentSingleton<T>where
T: Sync,
impl<T> Unpin for GhostPersistentSingleton<T>where
T: Unpin,
impl<T> UnwindSafe for GhostPersistentSingleton<T>where
T: UnwindSafe,
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
Source§impl<T, U> IntoSpecImpl<U> for Twhere
U: From<T>,
impl<T, U> IntoSpecImpl<U> for Twhere
U: From<T>,
Source§impl<T, VERUS_SPEC__A> TryFromSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: TryFrom<T>,
impl<T, VERUS_SPEC__A> TryFromSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: TryFrom<T>,
Source§exec fn obeys_try_from_spec() -> bool
exec fn obeys_try_from_spec() -> bool
Source§impl<T, VERUS_SPEC__A> TryIntoSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: TryInto<T>,
impl<T, VERUS_SPEC__A> TryIntoSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: TryInto<T>,
Source§exec fn obeys_try_into_spec() -> bool
exec fn obeys_try_into_spec() -> bool
Source§impl<T, U> TryIntoSpecImpl<U> for Twhere
U: TryFrom<T>,
impl<T, U> TryIntoSpecImpl<U> for Twhere
U: TryFrom<T>,
Source§open spec fn obeys_try_into_spec() -> bool
open spec fn obeys_try_into_spec() -> bool
{ <U as TryFromSpec<Self>>::obeys_try_from_spec() }