Skip to main content

ShareSet

Struct ShareSet 

Source
pub struct ShareSet { /* private fields */ }
Expand description

The shares of one split, as each custodian receives them.

The runtime holds the parts and nothing of the arithmetic: what it needs is to hand one share to a step that names it under reads:, and to say how many there are. A share has no canonical byte form here; laying it out is a container’s job, in a file or on paper. Each share’s y is wiped when the set is dropped, and Debug prints counts only.

Implementations§

Source§

impl ShareSet

Source

pub fn new(threshold: u8, shares: impl IntoIterator<Item = Share>) -> Self

A set of shares, index 1 first, of which threshold reconstruct the secret.

Source

pub fn threshold(&self) -> u8

How many shares reconstruct the secret.

Source

pub fn count(&self) -> u8

How many shares there are.

Source

pub fn share(&self, index: u8) -> Option<&Share>

The share with this index, from 1.

Source

pub fn only(&self) -> Option<&Share>

The one share of a set that holds exactly one, as a typed-back share arrives; None for a set of several, which has to be named.

Trait Implementations§

Source§

impl Debug for ShareSet

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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 = !

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.