Struct ibc_client_tendermint::types::TrustThreshold
source · pub struct TrustThreshold { /* private fields */ }Expand description
TrustThreshold defines the level of trust that a client has
towards a set of validators of a chain.
A trust threshold is represented as a fraction, i.e., a numerator and and a denominator. A typical trust threshold is 1/3 in practice. This type accepts even a value of 0, (numerator = 0, denominator = 0), which is used in the client state of an upgrading client.
Implementations§
source§impl TrustThreshold
impl TrustThreshold
sourcepub const ONE_THIRD: TrustThreshold = _
pub const ONE_THIRD: TrustThreshold = _
Constant for a trust threshold of 1/3.
sourcepub const TWO_THIRDS: TrustThreshold = _
pub const TWO_THIRDS: TrustThreshold = _
Constant for a trust threshold of 2/3.
sourcepub const ZERO: TrustThreshold = _
pub const ZERO: TrustThreshold = _
Constant for a trust threshold of 0/0.
sourcepub fn new(
numerator: u64,
denominator: u64
) -> Result<TrustThreshold, ClientError>
pub fn new( numerator: u64, denominator: u64 ) -> Result<TrustThreshold, ClientError>
Instantiate a TrustThreshold with the given denominator and numerator.
The constructor succeeds if long as the resulting fraction
is in the range[0, 1).
sourcepub fn denominator(&self) -> u64
pub fn denominator(&self) -> u64
The denominator of the fraction underlying this trust threshold.
Trait Implementations§
source§impl BorshDeserialize for TrustThresholdwhere
u64: BorshDeserialize,
impl BorshDeserialize for TrustThresholdwhere
u64: BorshDeserialize,
fn deserialize_reader<R>(reader: &mut R) -> Result<TrustThreshold, Error>where
R: Read,
source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
source§impl BorshSerialize for TrustThresholdwhere
u64: BorshSerialize,
impl BorshSerialize for TrustThresholdwhere
u64: BorshSerialize,
source§impl Clone for TrustThreshold
impl Clone for TrustThreshold
source§fn clone(&self) -> TrustThreshold
fn clone(&self) -> TrustThreshold
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for TrustThreshold
impl Debug for TrustThreshold
source§impl Decode for TrustThreshold
impl Decode for TrustThreshold
source§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<TrustThreshold, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<TrustThreshold, Error>where
__CodecInputEdqy: Input,
source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
source§impl<'de> Deserialize<'de> for TrustThreshold
impl<'de> Deserialize<'de> for TrustThreshold
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<TrustThreshold, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<TrustThreshold, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Display for TrustThreshold
impl Display for TrustThreshold
source§impl Encode for TrustThreshold
impl Encode for TrustThreshold
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
source§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
source§impl From<TrustThreshold> for Fraction
impl From<TrustThreshold> for Fraction
source§fn from(t: TrustThreshold) -> Fraction
fn from(t: TrustThreshold) -> Fraction
source§impl From<TrustThresholdFraction> for TrustThreshold
impl From<TrustThresholdFraction> for TrustThreshold
Conversion from Tendermint domain type into IBC domain type.
source§fn from(t: TrustThresholdFraction) -> TrustThreshold
fn from(t: TrustThresholdFraction) -> TrustThreshold
source§impl PartialEq for TrustThreshold
impl PartialEq for TrustThreshold
source§fn eq(&self, other: &TrustThreshold) -> bool
fn eq(&self, other: &TrustThreshold) -> bool
self and other values to be equal, and is used
by ==.source§impl Protobuf<Fraction> for TrustThreshold
impl Protobuf<Fraction> for TrustThreshold
source§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
source§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
source§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
source§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
source§fn encode_vec(self) -> Vec<u8>
fn encode_vec(self) -> Vec<u8>
Vec<u8>.source§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8> (or equivalent).source§fn encode_length_delimited_vec(self) -> Vec<u8>
fn encode_length_delimited_vec(self) -> Vec<u8>
Vec<u8> Protobuf-encoded message.