pub struct Id { /* private fields */ }Implementations§
Source§impl Id
impl Id
Sourcepub fn to_hex_string(&self) -> Option<String>
pub fn to_hex_string(&self) -> Option<String>
Converts to hex string.
For the PeerId -qB00000000000000000 it returns 2d71423030303030303030303030303030303030
For example:
Bytes = Hex
-qB00000000000000000 = 2d71423030303030303030303030303030303030
-qB00000000000000000 = 2d 71 42 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
-------------
|Char | Hex |
-------------
| - | 2D |
| q | 71 |
| B | 42 |
| 0 | 30 |
-------------Return None is some of the bytes are invalid UTF8 values.
§Panics
It will panic if the binascii::bin2hex from a too-small output buffer.
pub fn get_client_name(&self) -> Option<String>
Methods from Deref<Target = PeerId>§
pub fn client(&self) -> PeerClient
pub fn first_8_bytes_hex(&self) -> CompactString
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Id
impl RefUnwindSafe for Id
impl Send for Id
impl Sync for Id
impl Unpin for Id
impl UnwindSafe for Id
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more