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");
Sourcepub fn is_wasm_client_id(&self) -> bool
pub fn is_wasm_client_id(&self) -> bool
Check if the client identifier is for 08-wasm light client.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for ClientId
impl<'arbitrary> Arbitrary<'arbitrary> for ClientId
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<ClientId, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<ClientId, Error>
Generate an arbitrary value of
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<ClientId, Error>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<ClientId, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§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(value: ClientId) -> ClientStatePath
fn from(value: 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(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &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
Equality check against string literal (satisfies &ClientId == &str).
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 PartialOrd for ClientId
impl PartialOrd for ClientId
Source§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