Struct ibc::core::host::types::identifiers::ClientType
source · pub struct ClientType(/* private fields */);
Expand description
Type of the client, depending on the specific consensus algorithm.
Implementations§
source§impl ClientType
impl ClientType
sourcepub fn new(client_type: &str) -> Result<ClientType, IdentifierError>
pub fn new(client_type: &str) -> Result<ClientType, IdentifierError>
Constructs a new ClientType
from the given String
if it ends with a valid client identifier.
sourcepub fn build_client_id(&self, counter: u64) -> ClientId
pub fn build_client_id(&self, counter: u64) -> ClientId
Constructs a new ClientId
with this types client type and given
counter
.
This is equivalent to ClientId::new(self.as_str(), counter)
but
infallible since client type is assumed to be correct.
let client_type = ClientType::from_str("07-tendermint").unwrap();
let client_id = client_type.build_client_id(14);
assert_eq!(client_id.as_str(), "07-tendermint-14");
Trait Implementations§
source§impl BorshDeserialize for ClientType
impl BorshDeserialize for ClientType
fn deserialize_reader<R>(reader: &mut R) -> Result<ClientType, Error>where
R: Read,
source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
source§impl BorshSerialize for ClientType
impl BorshSerialize for ClientType
source§impl Clone for ClientType
impl Clone for ClientType
source§fn clone(&self) -> ClientType
fn clone(&self) -> ClientType
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 ClientType
impl Debug for ClientType
source§impl Decode for ClientType
impl Decode for ClientType
source§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<ClientType, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<ClientType, Error>where
__CodecInputEdqy: Input,
Attempt to deserialise the value from 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,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§impl<'de> Deserialize<'de> for ClientType
impl<'de> Deserialize<'de> for ClientType
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<ClientType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ClientType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for ClientType
impl Display for ClientType
source§impl Encode for ClientType
impl Encode for ClientType
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
Convert self to a slice and append it to the destination.
source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback>(
&self,
f: __CodecUsingEncodedCallback
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback>( &self, f: __CodecUsingEncodedCallback ) -> __CodecOutputReturn
Convert self to a slice and then invoke the given closure with it.
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl FromStr for ClientType
impl FromStr for ClientType
§type Err = IdentifierError
type Err = IdentifierError
The associated error which can be returned from parsing.
source§fn from_str(s: &str) -> Result<ClientType, <ClientType as FromStr>::Err>
fn from_str(s: &str) -> Result<ClientType, <ClientType as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moresource§impl Hash for ClientType
impl Hash for ClientType
source§impl Ord for ClientType
impl Ord for ClientType
source§fn cmp(&self, other: &ClientType) -> Ordering
fn cmp(&self, other: &ClientType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for ClientType
impl PartialEq for ClientType
source§fn eq(&self, other: &ClientType) -> bool
fn eq(&self, other: &ClientType) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ClientType
impl PartialOrd for ClientType
source§fn partial_cmp(&self, other: &ClientType) -> Option<Ordering>
fn partial_cmp(&self, other: &ClientType) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for ClientType
impl Serialize for ClientType
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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
source§impl TypeInfo for ClientType
impl TypeInfo for ClientType
impl EncodeLike for ClientType
impl Eq for ClientType
impl StructuralPartialEq for ClientType
Auto Trait Implementations§
impl Freeze for ClientType
impl RefUnwindSafe for ClientType
impl Send for ClientType
impl Sync for ClientType
impl Unpin for ClientType
impl UnwindSafe for ClientType
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