pub struct TrustThresholdFraction { /* private fields */ }
Expand description
TrustThresholdFraction defines what fraction of the total voting power of a known
and trusted validator set is sufficient for a commit to be
accepted going forward.
The Default::default()
returns true, iff at least a third of the trusted
voting power signed (in other words at least one honest validator signed).
Some clients might require more than +1/3 and can implement their own
TrustThreshold
which can be passed into all relevant methods.
Implementations§
Source§impl TrustThresholdFraction
impl TrustThresholdFraction
Sourcepub const TWO_THIRDS: Self = _
pub const TWO_THIRDS: Self = _
Constant for a trust threshold of 2/3.
Sourcepub fn new(numerator: u64, denominator: u64) -> Result<Self, Error>
pub fn new(numerator: u64, denominator: u64) -> Result<Self, Error>
Instantiate a TrustThresholdFraction if the given denominator and numerator are valid.
The parameters are valid iff 1/3 <= numerator/denominator <= 1
.
In any other case we return an error.
Sourcepub fn denominator(&self) -> u64
pub fn denominator(&self) -> u64
The denominator of this fraction.
Trait Implementations§
Source§impl Clone for TrustThresholdFraction
impl Clone for TrustThresholdFraction
Source§fn clone(&self) -> TrustThresholdFraction
fn clone(&self) -> TrustThresholdFraction
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TrustThresholdFraction
impl Debug for TrustThresholdFraction
Source§impl Default for TrustThresholdFraction
impl Default for TrustThresholdFraction
Source§impl<'de> Deserialize<'de> for TrustThresholdFraction
impl<'de> Deserialize<'de> for TrustThresholdFraction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for TrustThresholdFraction
impl Display for TrustThresholdFraction
Source§impl From<TrustThresholdFraction> for RawTrustThresholdFraction
impl From<TrustThresholdFraction> for RawTrustThresholdFraction
Source§fn from(f: TrustThresholdFraction) -> Self
fn from(f: TrustThresholdFraction) -> Self
Converts to this type from the input type.
Source§impl PartialEq for TrustThresholdFraction
impl PartialEq for TrustThresholdFraction
Source§impl Serialize for TrustThresholdFraction
impl Serialize for TrustThresholdFraction
impl Copy for TrustThresholdFraction
impl Eq for TrustThresholdFraction
impl StructuralPartialEq for TrustThresholdFraction
Auto Trait Implementations§
impl Freeze for TrustThresholdFraction
impl RefUnwindSafe for TrustThresholdFraction
impl Send for TrustThresholdFraction
impl Sync for TrustThresholdFraction
impl Unpin for TrustThresholdFraction
impl UnwindSafe for TrustThresholdFraction
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