OneRightKnowledge

Struct OneRightKnowledge 

Source
pub struct OneRightKnowledge<A, B, const TOTAL: u64 = 2> { /* private fields */ }
Expand description

OneRightKnowledge is a special case of Right that the fraction is always one and it does not own the resource.

Implementations§

Source§

impl<A, B, const TOTAL: u64> OneRightKnowledge<A, B, TOTAL>

Source

pub closed spec fn id(self) -> Loc

Returns the unique identifier.

Source

pub closed spec fn protocol_monoid(self) -> CsumP<A, B, TOTAL>

The underlying protocol monoid value for this resource.

Source

pub closed spec fn frac(self) -> int

Returns the fraction of this token, which should always be 1.

Source

pub open spec fn wf(self) -> bool

{
    &&& self.protocol_monoid().is_right()
    &&& self.protocol_monoid().is_valid()
    &&& !self.protocol_monoid().is_resource_owner()
    &&& self.frac() == 1
    &&& TOTAL >= 1

}

Type invariant.

Source

pub proof fn validate(tracked &self)

ensures
self.wf(),

OneRightKnowledge token satisfies the type invariant.

Source

pub proof fn validate_with_one_left_knowledge(tracked &self, tracked other: &OneLeftKnowledge<A, B, TOTAL>, )

ensures
self.id() != other.id(),

The existence of OneLeftKnowledge token ensures they can not have the same id.

Source

pub proof fn validate_with_one_left_owner(tracked &self, tracked other: &OneLeftOwner<A, B, TOTAL>)

ensures
self.id() != other.id(),

The existence of OneLeftOwner token ensures they can not have the same id.

Auto Trait Implementations§

§

impl<A, B, const TOTAL: u64> Freeze for OneRightKnowledge<A, B, TOTAL>

§

impl<A, B, const TOTAL: u64> RefUnwindSafe for OneRightKnowledge<A, B, TOTAL>

§

impl<A, B, const TOTAL: u64> Send for OneRightKnowledge<A, B, TOTAL>
where A: Send + Sync, B: Send + Sync,

§

impl<A, B, const TOTAL: u64> Sync for OneRightKnowledge<A, B, TOTAL>
where A: Sync + Send, B: Sync + Send,

§

impl<A, B, const TOTAL: u64> Unpin for OneRightKnowledge<A, B, TOTAL>
where A: Unpin, B: Unpin,

§

impl<A, B, const TOTAL: u64> UnwindSafe for OneRightKnowledge<A, B, TOTAL>
where A: UnwindSafe, B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: From<T>,

§

fn obeys_from_spec() -> bool

§

fn from_spec(v: T) -> VERUS_SPEC__A

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: Into<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> T

§

impl<T, U> IntoSpecImpl<U> for T
where U: From<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, VERUS_SPEC__A> TryFromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryFrom<T>,

§

fn obeys_try_from_spec() -> bool

§

fn try_from_spec( v: T, ) -> Result<VERUS_SPEC__A, <VERUS_SPEC__A as TryFrom<T>>::Error>

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, VERUS_SPEC__A> TryIntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryInto<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<T, <VERUS_SPEC__A as TryInto<T>>::Error>

§

impl<T, U> TryIntoSpecImpl<U> for T
where U: TryFrom<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<U, <U as TryFrom<T>>::Error>