Skip to main content

Group

Struct Group 

Source
pub struct Group<ID> {
    pub quorum_size: u64,
    pub ids: BTreeSet<ID>,
    pub groups: BTreeMap<String, Group<ID>>,
}
Expand description

One group of a HierarchicalQuorumSet: its members, which are IDs and child groups, and how many of them a set must reach to reach the group.

A set reaches an ID by holding it, and a child group by reaching enough members of that group in turn. So the groups form a tree whose leaves are IDs, and every level applies the same test.

Fields§

§quorum_size: u64

The number of members of the group that an accepted set must reach to reach the group.

§ids: BTreeSet<ID>

The IDs that the group holds directly.

§groups: BTreeMap<String, Group<ID>>

The child groups, by name.

Implementations§

Source§

impl<ID> Group<ID>
where ID: Ord + Clone,

Source

pub fn of_ids<I>(quorum_size: u64, ids: I) -> Self
where I: IntoIterator<Item = ID>,

Returns a group of ids, which a set reaches by holding quorum_size of them.

Source

pub fn of_groups<I, K>(quorum_size: u64, groups: I) -> Self
where I: IntoIterator<Item = (K, Group<ID>)>, K: Into<String>,

Returns a group of the child groups groups, each given with its name, which a set reaches by reaching quorum_size of them. A later group replaces an earlier one with the same name.

Trait Implementations§

Source§

impl<ID: Clone> Clone for Group<ID>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<ID: Debug> Debug for Group<ID>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<ID: Eq> Eq for Group<ID>

Source§

impl<ID: PartialEq> PartialEq for Group<ID>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<ID: PartialEq> StructuralPartialEq for Group<ID>

Auto Trait Implementations§

§

impl<ID> Forget for Group<ID>

§

impl<ID> Freeze for Group<ID>

§

impl<ID> RefUnwindSafe for Group<ID>

§

impl<ID> Send for Group<ID>
where BTreeSet<ID>: Send, BTreeMap<String, Group<ID>>: Send,

§

impl<ID> Sync for Group<ID>
where BTreeSet<ID>: Sync, BTreeMap<String, Group<ID>>: Sync,

§

impl<ID> Unpin for Group<ID>
where BTreeSet<ID>: Unpin, BTreeMap<String, Group<ID>>: Unpin,

§

impl<ID> UnsafeUnpin for Group<ID>

§

impl<ID> UnwindSafe for Group<ID>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.