Struct avalanche_types::ids::Id
source · [−]#[repr(transparent)]pub struct Id(_);
Expand description
ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/ids#ID 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,
sourcepub fn from_slice(d: &[u8]) -> Self
pub fn from_slice(d: &[u8]) -> Self
If the passed array is shorter than the ID_LEN, it fills in with zero.
Trait Implementations
sourceimpl AsBytes for Id
impl AsBytes for Id
sourcefn as_bytes(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
fn as_bytes(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Gets the bytes of this value. Read more
sourcefn as_bytes_mut(&mut self) -> &mut [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
where
Self: FromBytes,
fn as_bytes_mut(&mut self) -> &mut [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
where
Self: FromBytes,
Gets the bytes of this value mutably. Read more
sourcefn write_to<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
fn write_to<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
Writes a copy of self
to bytes
. Read more
sourcefn write_to_prefix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
fn write_to_prefix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
Writes a copy of self
to the prefix of bytes
. Read more
sourcefn write_to_suffix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
fn write_to_suffix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
Writes a copy of self
to the suffix of bytes
. Read more
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>,
Deserialize this value from the given Serde deserializer. Read more
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<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
fn read_from<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
Reads a copy of Self
from bytes
. Read more
sourcefn read_from_prefix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
fn read_from_prefix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
Reads a copy of Self
from the prefix of bytes
. Read more
sourcefn read_from_suffix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
fn read_from_suffix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
Reads a copy of Self
from the suffix of bytes
. Read more
sourcefn new_zeroed() -> Self
fn new_zeroed() -> Self
Creates an instance of 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
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>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl Copy for Id
impl Eq for Id
impl StructuralEq for Id
impl Unaligned for Id
Auto Trait Implementations
Blanket Implementations
impl<U> AsSliceOf for U where
U: AsRef<[u8]> + ?Sized,
impl<U> AsSliceOf for U where
U: AsRef<[u8]> + ?Sized,
fn as_slice_of<T>(&self) -> Result<&[T], Error> where
T: FromByteSlice,
sourceimpl<T> Base32Len for T where
T: AsRef<[u8]>,
impl<T> Base32Len for T where
T: AsRef<[u8]>,
sourcefn base32_len(&self) -> usize
fn base32_len(&self) -> usize
Calculate the base32 serialized length
sourceimpl<T> Base32Len for T where
T: AsRef<[u8]>,
impl<T> Base32Len for T where
T: AsRef<[u8]>,
sourcefn base32_len(&self) -> usize
fn base32_len(&self) -> usize
Calculate the base32 serialized length
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToBase32 for T where
T: AsRef<[u8]>,
impl<T> ToBase32 for T where
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,
Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate. Read more
sourceimpl<T> ToBase32 for T where
T: AsRef<[u8]>,
impl<T> ToBase32 for T where
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,
Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate. Read more
sourceimpl<T> ToHex for T where
T: AsRef<[u8]>,
impl<T> ToHex for T where
T: AsRef<[u8]>,
sourcefn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self
into the result. Lower case
letters are used (e.g. f9b4ca
) Read more
sourcefn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self
into the result. Upper case
letters are used (e.g. F9B4CA
) Read more