ibc_types::lightclients::tendermint

Struct TrustThreshold

pub struct TrustThreshold {
    pub numerator: u64,
    pub denominator: u64,
}
Expand description

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.

Fields§

§numerator: u64§denominator: u64

Implementations§

§

impl TrustThreshold

pub const ONE_THIRD: TrustThreshold = _

Constant for a trust threshold of 1/3.

pub const TWO_THIRDS: TrustThreshold = _

Constant for a trust threshold of 2/3.

pub const ZERO: TrustThreshold = _

Constant for a trust threshold of 0/0.

pub fn new(numerator: u64, denominator: u64) -> Result<TrustThreshold, Error>

Instantiate a TrustThreshold with the given denominator and numerator.

The constructor succeeds if long as the resulting fraction is in the range[0, 1).

pub fn numerator(&self) -> u64

The numerator of the fraction underlying this trust threshold.

pub fn denominator(&self) -> u64

The denominator of the fraction underlying this trust threshold.

Trait Implementations§

§

impl Clone for TrustThreshold

§

fn clone(&self) -> TrustThreshold

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
§

impl Debug for TrustThreshold

§

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

Formats the value using the given formatter. Read more
§

impl Default for TrustThreshold

§

fn default() -> TrustThreshold

Returns the “default value” for a type. Read more
§

impl<'de> Deserialize<'de> for TrustThreshold

§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TrustThreshold, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for TrustThreshold

§

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

Formats the value using the given formatter. Read more
§

impl From<TrustThresholdFraction> for TrustThreshold

Conversion from Tendermint domain type into IBC domain type.

§

fn from(t: TrustThresholdFraction) -> TrustThreshold

Converts to this type from the input type.
§

impl PartialEq for TrustThreshold

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Protobuf<Fraction> for TrustThreshold

§

fn encode<B>(self, buf: &mut B) -> Result<(), Error>
where B: BufMut,

Encode into a buffer in Protobuf format. Read more
§

fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>
where B: BufMut,

Encode with a length-delimiter to a buffer in Protobuf format. Read more
§

fn decode<B>(buf: B) -> Result<Self, Error>
where B: Buf,

Constructor that attempts to decode an instance from a buffer. Read more
§

fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>
where B: Buf,

Constructor that attempts to decode a length-delimited instance from the buffer. Read more
§

fn encoded_len(self) -> usize

Returns the encoded length of the message without a length delimiter. Read more
§

fn encode_vec(self) -> Vec<u8>

Encodes into a Protobuf-encoded Vec<u8>.
§

fn decode_vec(v: &[u8]) -> Result<Self, Error>

Constructor that attempts to decode a Protobuf-encoded instance from a Vec<u8> (or equivalent).
§

fn encode_length_delimited_vec(self) -> Vec<u8>

Encode with a length-delimiter to a Vec<u8> Protobuf-encoded message.
§

fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>

Constructor that attempts to decode a Protobuf-encoded instance with a length-delimiter from a Vec<u8> or equivalent.
§

impl Serialize for TrustThreshold

§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl TryFrom<Fraction> for TrustThreshold

§

type Error = Error

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

fn try_from( value: Fraction, ) -> Result<TrustThreshold, <TrustThreshold as TryFrom<Fraction>>::Error>

Performs the conversion.
§

impl Copy for TrustThreshold

§

impl Eq for TrustThreshold

§

impl StructuralPartialEq for TrustThreshold

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

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,