Struct ibc::ics24_host::identifier::ChainId [−][src]
pub struct ChainId { /* fields omitted */ }
Expand description
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
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);
Extract the version from the given chain identifier.
use ibc::ics24_host::identifier::ChainId; assert_eq!(ChainId::chain_version("chain--a-0"), 0); assert_eq!(ChainId::chain_version("ibc-10"), 10); assert_eq!(ChainId::chain_version("cosmos-hub-97"), 97); assert_eq!(ChainId::chain_version("testnet-helloworld-2"), 2);
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
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
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for ChainId
impl UnwindSafe for ChainId
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Wrap the input message T
in a tonic::Request
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more