Canonical

Struct Canonical 

Source
pub struct Canonical<'a, 'b, 'r, R, T> { /* private fields */ }
Expand description

Canonical captures the state for finding the quorum between a set of Dids and their references, attempting to agree on a Git commit or tag.

Construction happens through Canonical::new, at which point you must use Canonical::find_objects so that the state has the set of Objects it must use for the quorum calculation.

At this point, the caller can either call Canonical::quorum to find the quorum, or modify the calculation by produce a CanonicalWithConvergence using Canonical::with_convergence, and then using CanonicalWithConvergence::quorum.

Implementations§

Source§

impl<'a, 'b, 'r, R> Canonical<'a, 'b, 'r, R, Initial>

Source

pub fn new( refname: Qualified<'a>, rule: &'b Rule<ResolvedDelegates, Threshold>, repo: &'r R, ) -> Canonical<'a, 'b, 'r, R, Initial>

Construct a new Canonical with the given Qualified reference, a canonical reference ValidRule for that reference, and the Git repository to load and check the Git data.

Source

pub fn find_objects( self, ) -> Result<Canonical<'a, 'b, 'r, R, ObjectsFound>, FindObjectsError>

Find the objects for the Canonical computation, and prepare it to find the quorum.

Source§

impl<'a, 'b, 'r, R> Canonical<'a, 'b, 'r, R, ObjectsFound>

Source

pub fn with_convergence( self, candidate: Did, object: Object, ) -> CanonicalWithConvergence<'a, 'b, 'r, R>

Adds the check for convergence before finding the quorum.

Source

pub fn quorum(self) -> Result<Quorum<'a>, QuorumError>

Find the Quorum for the canonical computation.

Source

pub fn missing(&self) -> &Missing

If there are Missing objects, these may be reported by the caller, and if further objects are found, then these can be marked using Canonical::found_objects.

Source

pub fn found_objects( &mut self, objects: impl IntoIterator<Item = (Did, Object)>, )

Mark the objects provided as found, removing them from the Missing set.

Trait Implementations§

Source§

impl<'a, 'b, 'r, R> AsRef<Canonical<'a, 'b, 'r, R, ObjectsFound>> for CanonicalWithConvergence<'a, 'b, 'r, R>

Source§

fn as_ref(&self) -> &Canonical<'a, 'b, 'r, R, ObjectsFound>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, 'b, 'r, R, T> Debug for Canonical<'a, 'b, 'r, R, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'b, 'r, R, T> Freeze for Canonical<'a, 'b, 'r, R, T>

§

impl<'a, 'b, 'r, R, T> RefUnwindSafe for Canonical<'a, 'b, 'r, R, T>

§

impl<'a, 'b, 'r, R, T> Send for Canonical<'a, 'b, 'r, R, T>
where R: Sync, T: Send,

§

impl<'a, 'b, 'r, R, T> Sync for Canonical<'a, 'b, 'r, R, T>
where R: Sync, T: Sync,

§

impl<'a, 'b, 'r, R, T> Unpin for Canonical<'a, 'b, 'r, R, T>
where T: Unpin,

§

impl<'a, 'b, 'r, R, T> UnwindSafe for Canonical<'a, 'b, 'r, R, T>

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.

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoInit<ZeroInit> for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,