pub struct ExclusiveGhost<T>(/* private fields */);Expand description
ExclusiveGhost is a token that always provides exclusive access to a ghost value of type T.
No two ExclusiveGhost tokens can have the same id.
Implementations§
Source§impl<T> ExclusiveGhost<T>
impl<T> ExclusiveGhost<T>
Sourcepub open spec fn view(self) -> T
pub open spec fn view(self) -> T
{ self.value() }Returns the ghost value of type T, an alias of Self::value().
Sourcepub open spec fn wf(self) -> bool
pub open spec fn wf(self) -> bool
{ self.pcm() is Excl }Type invariant: the PCM element must be Excl.
Sourcepub proof fn alloc(value: T) -> tracked res : Self
pub proof fn alloc(value: T) -> tracked res : Self
ensures
res.view() == value,res.wf(),Allocates a new ExclusiveGhost with the given value。
Sourcepub proof fn update(tracked &mut self, value: T) -> res : T
pub proof fn update(tracked &mut self, value: T) -> res : T
ensures
self.id() == old(self).id(),self.view() == value,self.wf(),Updates the ghost value and returns the old value.
Sourcepub proof fn validate_with_other(tracked &mut self, tracked other: &Self)
pub proof fn validate_with_other(tracked &mut self, tracked other: &Self)
ensures
*old(self) == *self,self.id() != other.id(),self.wf(),The existence of two ExclusiveGhost tokens ensures that they do not have the same id.
Auto Trait Implementations§
impl<T> Freeze for ExclusiveGhost<T>
impl<T> RefUnwindSafe for ExclusiveGhost<T>where
T: RefUnwindSafe,
impl<T> Send for ExclusiveGhost<T>where
T: Send,
impl<T> Sync for ExclusiveGhost<T>where
T: Sync,
impl<T> Unpin for ExclusiveGhost<T>where
T: Unpin,
impl<T> UnwindSafe for ExclusiveGhost<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
Mutably borrows from an owned value. Read more