Struct alloy_primitives::FixedBytes
source · #[repr(transparent)]pub struct FixedBytes<const N: usize>(pub [u8; N]);Expand description
A byte array of fixed length ([u8; N]).
This type allows us to more tightly control serialization, deserialization. rlp encoding, decoding, and other type-level attributes for fixed-length byte arrays.
Users looking to prevent type-confusion between byte arrays of different
lengths should use the wrap_fixed_bytes! macro
to create a new fixed-length byte array type.
Tuple Fields§
§0: [u8; N]Implementations§
source§impl<const N: usize> FixedBytes<N>
impl<const N: usize> FixedBytes<N>
sourcepub const fn new(bytes: [u8; N]) -> Self
pub const fn new(bytes: [u8; N]) -> Self
Wraps the given byte array in FixedBytes.
sourcepub const fn with_last_byte(x: u8) -> Self
pub const fn with_last_byte(x: u8) -> Self
Creates a new FixedBytes with the last byte set to x.
sourcepub const fn repeat_byte(byte: u8) -> Self
pub const fn repeat_byte(byte: u8) -> Self
Creates a new FixedBytes where all bytes are set to byte.
sourcepub const fn concat_const<const M: usize, const Z: usize>(
self,
other: FixedBytes<M>
) -> FixedBytes<Z>
pub const fn concat_const<const M: usize, const Z: usize>( self, other: FixedBytes<M> ) -> FixedBytes<Z>
Concatenate two FixedBytes.
Due to constraints in the language, the user must specify the value of
the output size Z.
Panics
Panics if Z is not equal to N + M.
sourcepub fn from_slice(value: &[u8]) -> Self
pub fn from_slice(value: &[u8]) -> Self
Create a new FixedBytes from the given slice src.
Note
The given bytes are interpreted in big endian order.
Panics
If the length of src and the number of bytes in Self do not match.
sourcepub fn left_padding_from(value: &[u8]) -> Self
pub fn left_padding_from(value: &[u8]) -> Self
Create a new FixedBytes from the given slice src, left-padding it
with zeroes if necessary.
Note
The given bytes are interpreted in big endian order.
Panics
Panics if src.len() > N.
sourcepub fn right_padding_from(value: &[u8]) -> Self
pub fn right_padding_from(value: &[u8]) -> Self
Create a new FixedBytes from the given slice src, right-padding it
with zeroes if necessary.
Note
The given bytes are interpreted in big endian order.
Panics
Panics if src.len() > N.
sourcepub const fn as_slice(&self) -> &[u8] ⓘ
pub const fn as_slice(&self) -> &[u8] ⓘ
Returns a slice containing the entire array. Equivalent to &s[..].
sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Returns a mutable slice containing the entire array. Equivalent to
&mut s[..].
sourcepub fn covers(&self, other: &Self) -> bool
pub fn covers(&self, other: &Self) -> bool
Returns true if all bits set in self are also set in b.
sourcepub const fn const_covers(self, other: Self) -> bool
pub const fn const_covers(self, other: Self) -> bool
Returns true if all bits set in self are also set in b.
sourcepub const fn const_eq(&self, other: &Self) -> bool
pub const fn const_eq(&self, other: &Self) -> bool
Compile-time equality. NOT constant-time equality.
sourcepub const fn const_is_zero(&self) -> bool
pub const fn const_is_zero(&self) -> bool
Returns true if no bits are set.
Methods from Deref<Target = [u8; N]>§
1.57.0 · sourcepub fn as_slice(&self) -> &[T]
pub fn as_slice(&self) -> &[T]
Returns a slice containing the entire array. Equivalent to &s[..].
1.57.0 · sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Returns a mutable slice containing the entire array. Equivalent to
&mut s[..].
sourcepub fn each_ref(&self) -> [&T; N]
🔬This is a nightly-only experimental API. (array_methods)
pub fn each_ref(&self) -> [&T; N]
array_methods)Borrows each element and returns an array of references with the same
size as self.
Example
#![feature(array_methods)]
let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);This method is particularly useful if combined with other methods, like
map. This way, you can avoid moving the original
array if its elements are not Copy.
#![feature(array_methods)]
let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);
// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);sourcepub fn each_mut(&mut self) -> [&mut T; N]
🔬This is a nightly-only experimental API. (array_methods)
pub fn each_mut(&mut self) -> [&mut T; N]
array_methods)Borrows each element mutably and returns an array of mutable references
with the same size as self.
Example
#![feature(array_methods)]
let mut floats = [3.1, 2.7, -1.0];
let float_refs: [&mut f64; 3] = floats.each_mut();
*float_refs[0] = 0.0;
assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]);
assert_eq!(floats, [0.0, 2.7, -1.0]);sourcepub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])
🔬This is a nightly-only experimental API. (split_array)
pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])
split_array)Divides one array reference into two at an index.
The first will contain all indices from [0, M) (excluding
the index M itself) and the second will contain all
indices from [M, N) (excluding the index N itself).
Panics
Panics if M > N.
Examples
#![feature(split_array)]
let v = [1, 2, 3, 4, 5, 6];
{
let (left, right) = v.split_array_ref::<0>();
assert_eq!(left, &[]);
assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<2>();
assert_eq!(left, &[1, 2]);
assert_eq!(right, &[3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<6>();
assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
assert_eq!(right, &[]);
}sourcepub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])
🔬This is a nightly-only experimental API. (split_array)
pub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])
split_array)Divides one mutable array reference into two at an index.
The first will contain all indices from [0, M) (excluding
the index M itself) and the second will contain all
indices from [M, N) (excluding the index N itself).
Panics
Panics if M > N.
Examples
#![feature(split_array)]
let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.split_array_mut::<2>();
assert_eq!(left, &mut [1, 0][..]);
assert_eq!(right, &mut [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);sourcepub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])
🔬This is a nightly-only experimental API. (split_array)
pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])
split_array)Divides one array reference into two at an index from the end.
The first will contain all indices from [0, N - M) (excluding
the index N - M itself) and the second will contain all
indices from [N - M, N) (excluding the index N itself).
Panics
Panics if M > N.
Examples
#![feature(split_array)]
let v = [1, 2, 3, 4, 5, 6];
{
let (left, right) = v.rsplit_array_ref::<0>();
assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
assert_eq!(right, &[]);
}
{
let (left, right) = v.rsplit_array_ref::<2>();
assert_eq!(left, &[1, 2, 3, 4]);
assert_eq!(right, &[5, 6]);
}
{
let (left, right) = v.rsplit_array_ref::<6>();
assert_eq!(left, &[]);
assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}sourcepub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])
🔬This is a nightly-only experimental API. (split_array)
pub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])
split_array)Divides one mutable array reference into two at an index from the end.
The first will contain all indices from [0, N - M) (excluding
the index N - M itself) and the second will contain all
indices from [N - M, N) (excluding the index N itself).
Panics
Panics if M > N.
Examples
#![feature(split_array)]
let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.rsplit_array_mut::<4>();
assert_eq!(left, &mut [1, 0]);
assert_eq!(right, &mut [3, 0, 5, 6][..]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);sourcepub fn as_ascii(&self) -> Option<&[AsciiChar; N]>
🔬This is a nightly-only experimental API. (ascii_char)
pub fn as_ascii(&self) -> Option<&[AsciiChar; N]>
ascii_char)Converts this array of bytes into a array of ASCII characters,
or returns None if any of the characters is non-ASCII.
Examples
#![feature(ascii_char)]
#![feature(const_option)]
const HEX_DIGITS: [std::ascii::Char; 16] =
*b"0123456789abcdef".as_ascii().unwrap();
assert_eq!(HEX_DIGITS[1].as_str(), "1");
assert_eq!(HEX_DIGITS[10].as_str(), "a");sourcepub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar; N]
🔬This is a nightly-only experimental API. (ascii_char)
pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar; N]
ascii_char)Converts this array of bytes into a array of ASCII characters, without checking whether they’re valid.
Safety
Every byte in the array must be in 0..=127, or else this is UB.
Trait Implementations§
source§impl AsMut<FixedBytes<20>> for Address
impl AsMut<FixedBytes<20>> for Address
source§fn as_mut(&mut self) -> &mut FixedBytes<20>
fn as_mut(&mut self) -> &mut FixedBytes<20>
source§impl AsMut<FixedBytes<24>> for Function
impl AsMut<FixedBytes<24>> for Function
source§fn as_mut(&mut self) -> &mut FixedBytes<24>
fn as_mut(&mut self) -> &mut FixedBytes<24>
source§impl AsMut<FixedBytes<256>> for Bloom
impl AsMut<FixedBytes<256>> for Bloom
source§fn as_mut(&mut self) -> &mut FixedBytes<256>
fn as_mut(&mut self) -> &mut FixedBytes<256>
source§impl AsRef<FixedBytes<20>> for Address
impl AsRef<FixedBytes<20>> for Address
source§fn as_ref(&self) -> &FixedBytes<20>
fn as_ref(&self) -> &FixedBytes<20>
source§impl AsRef<FixedBytes<24>> for Function
impl AsRef<FixedBytes<24>> for Function
source§fn as_ref(&self) -> &FixedBytes<24>
fn as_ref(&self) -> &FixedBytes<24>
source§impl AsRef<FixedBytes<256>> for Bloom
impl AsRef<FixedBytes<256>> for Bloom
source§fn as_ref(&self) -> &FixedBytes<256>
fn as_ref(&self) -> &FixedBytes<256>
source§impl<const N: usize> BitAnd<FixedBytes<N>> for FixedBytes<N>
impl<const N: usize> BitAnd<FixedBytes<N>> for FixedBytes<N>
source§impl<const N: usize> BitAndAssign<FixedBytes<N>> for FixedBytes<N>
impl<const N: usize> BitAndAssign<FixedBytes<N>> for FixedBytes<N>
source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moresource§impl<const N: usize> BitOr<FixedBytes<N>> for FixedBytes<N>
impl<const N: usize> BitOr<FixedBytes<N>> for FixedBytes<N>
source§impl<const N: usize> BitOrAssign<FixedBytes<N>> for FixedBytes<N>
impl<const N: usize> BitOrAssign<FixedBytes<N>> for FixedBytes<N>
source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moresource§impl<const N: usize> BitXor<FixedBytes<N>> for FixedBytes<N>
impl<const N: usize> BitXor<FixedBytes<N>> for FixedBytes<N>
source§impl<const N: usize> BitXorAssign<FixedBytes<N>> for FixedBytes<N>
impl<const N: usize> BitXorAssign<FixedBytes<N>> for FixedBytes<N>
source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^= operation. Read moresource§impl<const N: usize> Clone for FixedBytes<N>
impl<const N: usize> Clone for FixedBytes<N>
source§fn clone(&self) -> FixedBytes<N>
fn clone(&self) -> FixedBytes<N>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<const N: usize> Debug for FixedBytes<N>
impl<const N: usize> Debug for FixedBytes<N>
source§impl<'a, const N: usize> Default for &'a FixedBytes<N>
impl<'a, const N: usize> Default for &'a FixedBytes<N>
source§impl<const N: usize> Default for FixedBytes<N>
impl<const N: usize> Default for FixedBytes<N>
source§impl<const N: usize> Deref for FixedBytes<N>
impl<const N: usize> Deref for FixedBytes<N>
source§impl<const N: usize> DerefMut for FixedBytes<N>
impl<const N: usize> DerefMut for FixedBytes<N>
source§impl<const N: usize> Display for FixedBytes<N>
impl<const N: usize> Display for FixedBytes<N>
source§impl From<Address> for FixedBytes<20>
impl From<Address> for FixedBytes<20>
source§impl From<Bloom> for FixedBytes<256>
impl From<Bloom> for FixedBytes<256>
source§impl From<FixedBytes<1>> for I8
impl From<FixedBytes<1>> for I8
source§impl From<FixedBytes<1>> for U8
impl From<FixedBytes<1>> for U8
source§impl From<FixedBytes<1>> for i8
impl From<FixedBytes<1>> for i8
source§impl From<FixedBytes<1>> for u8
impl From<FixedBytes<1>> for u8
source§impl From<FixedBytes<16>> for I128
impl From<FixedBytes<16>> for I128
source§impl From<FixedBytes<16>> for U128
impl From<FixedBytes<16>> for U128
source§impl From<FixedBytes<16>> for i128
impl From<FixedBytes<16>> for i128
source§impl From<FixedBytes<16>> for u128
impl From<FixedBytes<16>> for u128
source§impl From<FixedBytes<2>> for I16
impl From<FixedBytes<2>> for I16
source§impl From<FixedBytes<2>> for U16
impl From<FixedBytes<2>> for U16
source§impl From<FixedBytes<2>> for i16
impl From<FixedBytes<2>> for i16
source§impl From<FixedBytes<2>> for u16
impl From<FixedBytes<2>> for u16
source§impl From<FixedBytes<20>> for Address
impl From<FixedBytes<20>> for Address
source§fn from(original: FixedBytes<20>) -> Address
fn from(original: FixedBytes<20>) -> Address
source§impl From<FixedBytes<20>> for I160
impl From<FixedBytes<20>> for I160
source§impl From<FixedBytes<20>> for U160
impl From<FixedBytes<20>> for U160
source§impl From<FixedBytes<24>> for Function
impl From<FixedBytes<24>> for Function
source§fn from(original: FixedBytes<24>) -> Function
fn from(original: FixedBytes<24>) -> Function
source§impl From<FixedBytes<256>> for Bloom
impl From<FixedBytes<256>> for Bloom
source§fn from(original: FixedBytes<256>) -> Bloom
fn from(original: FixedBytes<256>) -> Bloom
source§impl From<FixedBytes<32>> for I256
impl From<FixedBytes<32>> for I256
source§impl From<FixedBytes<32>> for U256
impl From<FixedBytes<32>> for U256
source§impl From<FixedBytes<4>> for I32
impl From<FixedBytes<4>> for I32
source§impl From<FixedBytes<4>> for U32
impl From<FixedBytes<4>> for U32
source§impl From<FixedBytes<4>> for i32
impl From<FixedBytes<4>> for i32
source§impl From<FixedBytes<4>> for u32
impl From<FixedBytes<4>> for u32
source§impl From<FixedBytes<64>> for I512
impl From<FixedBytes<64>> for I512
source§impl From<FixedBytes<64>> for U512
impl From<FixedBytes<64>> for U512
source§impl From<FixedBytes<8>> for I64
impl From<FixedBytes<8>> for I64
source§impl From<FixedBytes<8>> for U64
impl From<FixedBytes<8>> for U64
source§impl From<FixedBytes<8>> for i64
impl From<FixedBytes<8>> for i64
source§impl From<FixedBytes<8>> for u64
impl From<FixedBytes<8>> for u64
source§impl<const N: usize> From<FixedBytes<N>> for [u8; N]
impl<const N: usize> From<FixedBytes<N>> for [u8; N]
source§fn from(s: FixedBytes<N>) -> Self
fn from(s: FixedBytes<N>) -> Self
source§impl From<Function> for FixedBytes<24>
impl From<Function> for FixedBytes<24>
source§impl<const N: usize> FromHex for FixedBytes<N>
impl<const N: usize> FromHex for FixedBytes<N>
source§impl<const N: usize> FromStr for FixedBytes<N>
impl<const N: usize> FromStr for FixedBytes<N>
source§impl<const N: usize> Hash for FixedBytes<N>
impl<const N: usize> Hash for FixedBytes<N>
source§impl<__IdxT, const N: usize> IndexMut<__IdxT> for FixedBytes<N>where
[u8; N]: IndexMut<__IdxT>,
impl<__IdxT, const N: usize> IndexMut<__IdxT> for FixedBytes<N>where [u8; N]: IndexMut<__IdxT>,
source§impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime FixedBytes<N>
impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime FixedBytes<N>
source§impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime mut FixedBytes<N>
impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime mut FixedBytes<N>
source§impl<const N: usize> IntoIterator for FixedBytes<N>
impl<const N: usize> IntoIterator for FixedBytes<N>
source§impl<const N: usize> LowerHex for FixedBytes<N>
impl<const N: usize> LowerHex for FixedBytes<N>
source§impl<const N: usize> Ord for FixedBytes<N>
impl<const N: usize> Ord for FixedBytes<N>
source§fn cmp(&self, other: &FixedBytes<N>) -> Ordering
fn cmp(&self, other: &FixedBytes<N>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<const N: usize> PartialEq<&[u8]> for FixedBytes<N>
impl<const N: usize> PartialEq<&[u8]> for FixedBytes<N>
source§impl<const N: usize> PartialEq<&[u8; N]> for FixedBytes<N>
impl<const N: usize> PartialEq<&[u8; N]> for FixedBytes<N>
source§impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8]
impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8]
source§fn eq(&self, other: &&FixedBytes<N>) -> bool
fn eq(&self, other: &&FixedBytes<N>) -> bool
self and other values to be equal, and is used
by ==.source§impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8; N]
impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8; N]
source§fn eq(&self, other: &&FixedBytes<N>) -> bool
fn eq(&self, other: &&FixedBytes<N>) -> bool
self and other values to be equal, and is used
by ==.source§impl<const N: usize> PartialEq<[u8]> for &FixedBytes<N>
impl<const N: usize> PartialEq<[u8]> for &FixedBytes<N>
source§impl<const N: usize> PartialEq<[u8]> for FixedBytes<N>
impl<const N: usize> PartialEq<[u8]> for FixedBytes<N>
source§impl<const N: usize> PartialEq<[u8; N]> for &FixedBytes<N>
impl<const N: usize> PartialEq<[u8; N]> for &FixedBytes<N>
source§impl<const N: usize> PartialEq<[u8; N]> for FixedBytes<N>
impl<const N: usize> PartialEq<[u8; N]> for FixedBytes<N>
source§impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8]
impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8]
source§fn eq(&self, other: &FixedBytes<N>) -> bool
fn eq(&self, other: &FixedBytes<N>) -> bool
self and other values to be equal, and is used
by ==.source§impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8; N]
impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8; N]
source§fn eq(&self, other: &FixedBytes<N>) -> bool
fn eq(&self, other: &FixedBytes<N>) -> bool
self and other values to be equal, and is used
by ==.source§impl<const N: usize> PartialEq<FixedBytes<N>> for [u8]
impl<const N: usize> PartialEq<FixedBytes<N>> for [u8]
source§fn eq(&self, other: &FixedBytes<N>) -> bool
fn eq(&self, other: &FixedBytes<N>) -> bool
self and other values to be equal, and is used
by ==.source§impl<const N: usize> PartialEq<FixedBytes<N>> for [u8; N]
impl<const N: usize> PartialEq<FixedBytes<N>> for [u8; N]
source§fn eq(&self, other: &FixedBytes<N>) -> bool
fn eq(&self, other: &FixedBytes<N>) -> bool
self and other values to be equal, and is used
by ==.source§impl<const N: usize> PartialEq<FixedBytes<N>> for FixedBytes<N>
impl<const N: usize> PartialEq<FixedBytes<N>> for FixedBytes<N>
source§fn eq(&self, other: &FixedBytes<N>) -> bool
fn eq(&self, other: &FixedBytes<N>) -> bool
self and other values to be equal, and is used
by ==.source§impl<const N: usize> PartialOrd<&[u8]> for FixedBytes<N>
impl<const N: usize> PartialOrd<&[u8]> for FixedBytes<N>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl<const N: usize> PartialOrd<&FixedBytes<N>> for [u8]
impl<const N: usize> PartialOrd<&FixedBytes<N>> for [u8]
source§fn partial_cmp(&self, other: &&FixedBytes<N>) -> Option<Ordering>
fn partial_cmp(&self, other: &&FixedBytes<N>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl<const N: usize> PartialOrd<[u8]> for &FixedBytes<N>
impl<const N: usize> PartialOrd<[u8]> for &FixedBytes<N>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl<const N: usize> PartialOrd<[u8]> for FixedBytes<N>
impl<const N: usize> PartialOrd<[u8]> for FixedBytes<N>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl<const N: usize> PartialOrd<FixedBytes<N>> for &[u8]
impl<const N: usize> PartialOrd<FixedBytes<N>> for &[u8]
source§fn partial_cmp(&self, other: &FixedBytes<N>) -> Option<Ordering>
fn partial_cmp(&self, other: &FixedBytes<N>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl<const N: usize> PartialOrd<FixedBytes<N>> for [u8]
impl<const N: usize> PartialOrd<FixedBytes<N>> for [u8]
source§fn partial_cmp(&self, other: &FixedBytes<N>) -> Option<Ordering>
fn partial_cmp(&self, other: &FixedBytes<N>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl<const N: usize> PartialOrd<FixedBytes<N>> for FixedBytes<N>
impl<const N: usize> PartialOrd<FixedBytes<N>> for FixedBytes<N>
source§fn partial_cmp(&self, other: &FixedBytes<N>) -> Option<Ordering>
fn partial_cmp(&self, other: &FixedBytes<N>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl<const N: usize> TryFrom<&[u8]> for FixedBytes<N>
impl<const N: usize> TryFrom<&[u8]> for FixedBytes<N>
Tries to create a FixedBytes<N> by copying from a slice &[u8]. Succeeds
if slice.len() == N.
source§impl<'a, const N: usize> TryFrom<&'a [u8]> for &'a FixedBytes<N>
impl<'a, const N: usize> TryFrom<&'a [u8]> for &'a FixedBytes<N>
Tries to create a ref FixedBytes<N> by copying from a slice &[u8].
Succeeds if slice.len() == N.
§type Error = TryFromSliceError
type Error = TryFromSliceError
source§impl<'a, const N: usize> TryFrom<&'a mut [u8]> for &'a mut FixedBytes<N>
impl<'a, const N: usize> TryFrom<&'a mut [u8]> for &'a mut FixedBytes<N>
Tries to create a ref FixedBytes<N> by copying from a mutable slice &mut [u8]. Succeeds if slice.len() == N.
§type Error = TryFromSliceError
type Error = TryFromSliceError
source§impl<const N: usize> TryFrom<&mut [u8]> for FixedBytes<N>
impl<const N: usize> TryFrom<&mut [u8]> for FixedBytes<N>
Tries to create a FixedBytes<N> by copying from a mutable slice &mut [u8]. Succeeds if slice.len() == N.
source§impl<const N: usize> UpperHex for FixedBytes<N>
impl<const N: usize> UpperHex for FixedBytes<N>
impl<const N: usize> Copy for FixedBytes<N>
impl<const N: usize> Eq for FixedBytes<N>
impl<const N: usize> StructuralEq for FixedBytes<N>
impl<const N: usize> StructuralPartialEq for FixedBytes<N>
Auto Trait Implementations§
impl<const N: usize> RefUnwindSafe for FixedBytes<N>
impl<const N: usize> Send for FixedBytes<N>
impl<const N: usize> Sync for FixedBytes<N>
impl<const N: usize> Unpin for FixedBytes<N>
impl<const N: usize> UnwindSafe for FixedBytes<N>
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
source§impl<T> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere T: AsRef<[u8]>,
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,
encode or other specialized functions insteadself into the result. Lower case
letters are used (e.g. f9b4ca)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,
encode or other specialized functions insteadself into the result. Upper case
letters are used (e.g. F9B4CA)