pub struct ClientId(/* private fields */);
Implementations§
source§impl ClientId
impl ClientId
sourcepub fn new(client_type: &str, counter: u64) -> Result<ClientId, IdentifierError>
pub fn new(client_type: &str, counter: u64) -> Result<ClientId, IdentifierError>
Builds a new client identifier.
Client identifiers are deterministically formed from two elements:
a prefix derived from the client type ctype
, and a monotonically
increasing counter
; these are separated by a dash “-”.
See also ClientType::build_client_id
method.
§Example
let client_type = ClientType::from_str("07-tendermint").unwrap();
let client_id = &client_type.build_client_id(0);
assert_eq!(client_id.as_str(), "07-tendermint-0");
Trait Implementations§
source§impl BorshDeserialize for ClientId
impl BorshDeserialize for ClientId
fn deserialize_reader<R>(reader: &mut R) -> Result<ClientId, 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 ClientId
impl BorshSerialize for ClientId
source§impl Decode for ClientId
impl Decode for ClientId
source§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<ClientId, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<ClientId, 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 ClientId
impl<'de> Deserialize<'de> for ClientId
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<ClientId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ClientId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Encode for ClientId
impl Encode for ClientId
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 From<ClientId> for ClientStatePath
impl From<ClientId> for ClientStatePath
source§fn from(original: ClientId) -> ClientStatePath
fn from(original: ClientId) -> ClientStatePath
Converts to this type from the input type.
source§impl JsonSchema for ClientId
impl JsonSchema for ClientId
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl Ord for ClientId
impl Ord for ClientId
source§impl PartialEq<str> for ClientId
impl PartialEq<str> for ClientId
Equality check against string literal (satisfies &ClientId == &str).
use core::str::FromStr;
use ibc_core_host_types::identifiers::ClientId;
let client_id = ClientId::from_str("clientidtwo");
assert!(client_id.is_ok());
client_id.map(|id| {assert_eq!(&id, "clientidtwo")});
source§impl PartialEq for ClientId
impl PartialEq for ClientId
source§impl PartialOrd for ClientId
impl PartialOrd for ClientId
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 ClientId
impl Serialize for ClientId
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
impl EncodeLike for ClientId
impl Eq for ClientId
impl StructuralPartialEq for ClientId
Auto Trait Implementations§
impl Freeze for ClientId
impl RefUnwindSafe for ClientId
impl Send for ClientId
impl Sync for ClientId
impl Unpin for ClientId
impl UnwindSafe for ClientId
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