pub struct OneLeftKnowledge<A, B, const TOTAL: u64 = 2> { /* private fields */ }Expand description
OneLeftKnowledge is a special case of Left that the fraction is always one and
it does not own the resource.
Implementations§
Source§impl<A, B, const TOTAL: u64> OneLeftKnowledge<A, B, TOTAL>
impl<A, B, const TOTAL: u64> OneLeftKnowledge<A, B, TOTAL>
Sourcepub closed spec fn protocol_monoid(self) -> CsumP<A, B, TOTAL>
pub closed spec fn protocol_monoid(self) -> CsumP<A, B, TOTAL>
The underlying protocol monoid value for this resource.
Sourcepub closed spec fn frac(self) -> int
pub closed spec fn frac(self) -> int
Returns the fraction of this token, which should always be 1.
Sourcepub open spec fn wf(self) -> bool
pub open spec fn wf(self) -> bool
{
&&& self.protocol_monoid().is_left()
&&& self.protocol_monoid().is_valid()
&&& !self.protocol_monoid().is_resource_owner()
&&& self.frac() == 1
&&& TOTAL >= 1
}Type invariant.
Sourcepub proof fn validate(tracked &self)
pub proof fn validate(tracked &self)
ensures
self.wf(),OneLeftKnowledge token satisfies the type invariant.
Sourcepub proof fn validate_with_one_right_knowledge(tracked
&self,
tracked other: &OneRightKnowledge<A, B, TOTAL>,
)
pub proof fn validate_with_one_right_knowledge(tracked &self, tracked other: &OneRightKnowledge<A, B, TOTAL>, )
ensures
self.id() != other.id(),The existence of OneRightKnowledge token ensures they can not have the same id.
Sourcepub proof fn validate_with_one_right_owner(tracked &self, tracked other: &OneRightOwner<A, B, TOTAL>)
pub proof fn validate_with_one_right_owner(tracked &self, tracked other: &OneRightOwner<A, B, TOTAL>)
ensures
self.id() != other.id(),The existence of OneRightOwner token ensures they can not have the same id.
Auto Trait Implementations§
impl<A, B, const TOTAL: u64> Freeze for OneLeftKnowledge<A, B, TOTAL>
impl<A, B, const TOTAL: u64> RefUnwindSafe for OneLeftKnowledge<A, B, TOTAL>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B, const TOTAL: u64> Send for OneLeftKnowledge<A, B, TOTAL>
impl<A, B, const TOTAL: u64> Sync for OneLeftKnowledge<A, B, TOTAL>
impl<A, B, const TOTAL: u64> Unpin for OneLeftKnowledge<A, B, TOTAL>
impl<A, B, const TOTAL: u64> UnwindSafe for OneLeftKnowledge<A, B, TOTAL>where
A: UnwindSafe,
B: 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