Struct ibc::ics24_host::identifier::ChainId[][src]

pub struct ChainId { /* fields omitted */ }

This type is subject to future changes.

TODO: ChainId validation is not standardized yet. is_epoch_format will most likely be replaced by validate_chain_id()-style function. See: https://github.com/informalsystems/ibc-rs/pull/304#discussion_r503917283.

Also, contrast with tendermint-rs ChainId type.

Implementations

impl ChainId[src]

pub fn new(name: String, version: u64) -> Self[src]

Creates a new ChainId given a chain name and an epoch number.

The returned ChainId will have the format: {chain name}-{epoch number}.

use ibc::ics24_host::identifier::ChainId;

let epoch_number = 10;
let id = ChainId::new("chainA".to_string(), epoch_number);
assert_eq!(id.version(), epoch_number);

pub fn as_str(&self) -> &str[src]

Get a reference to the underlying string.

pub fn version(&self) -> u64[src]

Extract the version from this chain identifier.

pub fn chain_version(chain_id: &str) -> u64[src]

Extract the version from the given chain identifier.

pub fn is_epoch_format(chain_id: &str) -> bool[src]

is_epoch_format() checks if a chain_id is in the format required for parsing epochs The chainID must be in the form: {chainID}-{version}

use ibc::ics24_host::identifier::ChainId;
assert_eq!(ChainId::is_epoch_format("chainA-0"), false);
assert_eq!(ChainId::is_epoch_format("chainA"), false);
assert_eq!(ChainId::is_epoch_format("chainA-1"), true);

Trait Implementations

impl Clone for ChainId[src]

impl Debug for ChainId[src]

impl Default for ChainId[src]

impl<'de> Deserialize<'de> for ChainId[src]

impl Display for ChainId[src]

impl Eq for ChainId[src]

impl From<Id> for ChainId[src]

impl FromStr for ChainId[src]

type Err = ValidationError

The associated error which can be returned from parsing.

impl Hash for ChainId[src]

impl Ord for ChainId[src]

impl PartialEq<ChainId> for ChainId[src]

impl PartialOrd<ChainId> for ChainId[src]

impl Serialize for ChainId[src]

impl StructuralEq for ChainId[src]

impl StructuralPartialEq for ChainId[src]

impl TryFrom<String> for ChainId[src]

type Error = ValidationKind

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for ChainId

impl Send for ChainId

impl Sync for ChainId

impl Unpin for ChainId

impl UnwindSafe for ChainId

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> DynClone for T where
    T: Clone
[src]

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

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoRequest<T> for T[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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

impl<T> WithSubscriber for T[src]