pub enum ExclusiveSP<A> {
Unit,
Exclusive(Option<A>),
Invalid,
}Variants§
Implementations§
Source§impl<A> ExclusiveSP<A>
impl<A> ExclusiveSP<A>
Source§impl<A> ExclusiveSP<A>
impl<A> ExclusiveSP<A>
Sourcepub open spec fn value(self) -> A
pub open spec fn value(self) -> A
{
match self {
ExclusiveSP::Exclusive(Some(x)) => x,
_ => arbitrary(),
}
}Sourcepub proof fn lemma_deposits(self, value: A)
pub proof fn lemma_deposits(self, value: A)
requires
self is Exclusive,self->Exclusive_0 is None,ensuresdeposits(self, map![() => value], ExclusiveSP::Exclusive(Some(value))),Trait Implementations§
Source§impl<A> Protocol<(), A> for ExclusiveSP<A>
impl<A> Protocol<(), A> for ExclusiveSP<A>
Source§open spec fn op(self, other: Self) -> Self
open spec fn op(self, other: Self) -> Self
{
match (self, other) {
(ExclusiveSP::Unit, x) => x,
(x, ExclusiveSP::Unit) => x,
_ => ExclusiveSP::Invalid,
}
}Source§open spec fn rel(self, s: Map<(), A>) -> bool
open spec fn rel(self, s: Map<(), A>) -> bool
{
match self {
ExclusiveSP::Unit => s.is_empty(),
ExclusiveSP::Exclusive(None) => s.is_empty(),
ExclusiveSP::Exclusive(Some(x)) => s =~= map![() => x],
ExclusiveSP::Invalid => false,
}
}Source§proof fn commutative(a: Self, b: Self)
proof fn commutative(a: Self, b: Self)
Source§proof fn associative(a: Self, b: Self, c: Self)
proof fn associative(a: Self, b: Self, c: Self)
Auto Trait Implementations§
impl<A> Freeze for ExclusiveSP<A>where
A: Freeze,
impl<A> RefUnwindSafe for ExclusiveSP<A>where
A: RefUnwindSafe,
impl<A> Send for ExclusiveSP<A>where
A: Send,
impl<A> Sync for ExclusiveSP<A>where
A: Sync,
impl<A> Unpin for ExclusiveSP<A>where
A: Unpin,
impl<A> UnsafeUnpin for ExclusiveSP<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for ExclusiveSP<A>where
A: 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