#[repr(transparent)]pub struct Id(_);
Expand description
ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/ids#ShortID ref. https://docs.rs/zerocopy/latest/zerocopy/trait.AsBytes.html#safety
Implementations
sourceimpl Id
impl Id
pub fn default() -> Self
pub fn empty() -> Self
pub fn is_empty(&self) -> bool
pub fn to_vec(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
pub fn from_slice(d: &[u8]) -> Self
sourcepub fn from_cert_pem_file(cert_file_path: &str) -> Result<Self>
pub fn from_cert_pem_file(cert_file_path: &str) -> Result<Self>
Loads a node ID from the PEM-encoded X509 certificate. ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/node#Node.Initialize
sourcepub fn from_cert_der_bytes<S>(cert_bytes: S) -> Result<Self>where
S: AsRef<[u8]>,
pub fn from_cert_der_bytes<S>(cert_bytes: S) -> Result<Self>where
S: AsRef<[u8]>,
Encodes the DER-encoded certificate bytes to a node ID. It applies “sha256” and “ripemd160” on “Certificate.Leaf.Raw”. ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/utils/hashing#PubkeyBytesToAddress ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/ids#ToShortID
pub fn short_id(&self) -> Id
Trait Implementations
sourceimpl AsBytes for Id
impl AsBytes for Id
sourcefn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
sourcefn as_bytes_mut(&mut self) -> &mut [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
where
Self: FromBytes,
fn as_bytes_mut(&mut self) -> &mut [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
where
Self: FromBytes,
sourcefn write_to<B>(&self, bytes: B) -> Option<()>where
B: ByteSliceMut,
fn write_to<B>(&self, bytes: B) -> Option<()>where
B: ByteSliceMut,
sourcefn write_to_prefix<B>(&self, bytes: B) -> Option<()>where
B: ByteSliceMut,
fn write_to_prefix<B>(&self, bytes: B) -> Option<()>where
B: ByteSliceMut,
sourcefn write_to_suffix<B>(&self, bytes: B) -> Option<()>where
B: ByteSliceMut,
fn write_to_suffix<B>(&self, bytes: B) -> Option<()>where
B: ByteSliceMut,
sourceimpl<'de> Deserialize<'de> for Id
impl<'de> Deserialize<'de> for Id
sourcefn 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>,
sourceimpl Display for Id
impl Display for Id
ref. https://doc.rust-lang.org/std/string/trait.ToString.html ref. https://doc.rust-lang.org/std/fmt/trait.Display.html Use “Self.to_string()” to directly invoke this
sourceimpl FromBytes for Id
impl FromBytes for Id
sourcefn read_from_prefix<B>(bytes: B) -> Option<Self>where
B: ByteSlice,
fn read_from_prefix<B>(bytes: B) -> Option<Self>where
B: ByteSlice,
sourcefn read_from_suffix<B>(bytes: B) -> Option<Self>where
B: ByteSlice,
fn read_from_suffix<B>(bytes: B) -> Option<Self>where
B: ByteSlice,
sourcefn new_zeroed() -> Self
fn new_zeroed() -> Self
Self
from zeroed bytes.sourceimpl Hash for Id
impl Hash for Id
ref. https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq
sourceimpl Ord for Id
impl Ord for Id
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialOrd<Id> for Id
impl PartialOrd<Id> for Id
sourcefn partial_cmp(&self, other: &Id) -> Option<Ordering>
fn partial_cmp(&self, other: &Id) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Id
impl Eq for Id
impl StructuralEq for Id
impl Unaligned for Id
Auto Trait Implementations
Blanket Implementations
impl<U> AsSliceOf for Uwhere
U: AsRef<[u8]> + ?Sized,
impl<U> AsSliceOf for Uwhere
U: AsRef<[u8]> + ?Sized,
fn as_slice_of<T>(&self) -> Result<&[T], Error>where
T: FromByteSlice,
sourceimpl<T> Base32Len for Twhere
T: AsRef<[u8]>,
impl<T> Base32Len for Twhere
T: AsRef<[u8]>,
sourcefn base32_len(&self) -> usize
fn base32_len(&self) -> usize
sourceimpl<T> Base32Len for Twhere
T: AsRef<[u8]>,
impl<T> Base32Len for Twhere
T: AsRef<[u8]>,
sourcefn base32_len(&self) -> usize
fn base32_len(&self) -> usize
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
sourceimpl<T> ToBase32 for Twhere
T: AsRef<[u8]>,
impl<T> ToBase32 for Twhere
T: AsRef<[u8]>,
sourcefn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
sourceimpl<T> ToBase32 for Twhere
T: AsRef<[u8]>,
impl<T> ToBase32 for Twhere
T: AsRef<[u8]>,
sourcefn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
sourceimpl<T> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere
T: AsRef<[u8]>,
sourcefn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
) Read moresourcefn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
) Read more