#[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>

source

pub const ZERO: Self = _

Array of Zero bytes.

source

pub const fn new(bytes: [u8; N]) -> Self

Wraps the given byte array in FixedBytes.

source

pub const fn with_last_byte(x: u8) -> Self

Creates a new FixedBytes with the last byte set to x.

source

pub const fn repeat_byte(byte: u8) -> Self

Creates a new FixedBytes where all bytes are set to byte.

source

pub const fn len_bytes() -> usize

Returns the size of this byte array (N).

source

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.

source

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.

source

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.

source

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.

source

pub const fn as_slice(&self) -> &[u8]

Returns a slice containing the entire array. Equivalent to &s[..].

source

pub fn as_mut_slice(&mut self) -> &mut [u8]

Returns a mutable slice containing the entire array. Equivalent to &mut s[..].

source

pub fn covers(&self, other: &Self) -> bool

Returns true if all bits set in self are also set in b.

source

pub const fn const_covers(self, other: Self) -> bool

Returns true if all bits set in self are also set in b.

source

pub const fn const_eq(&self, other: &Self) -> bool

Compile-time equality. NOT constant-time equality.

source

pub fn is_zero(&self) -> bool

Returns true if no bits are set.

source

pub const fn const_is_zero(&self) -> bool

Returns true if no bits are set.

source

pub const fn bit_and(self, rhs: Self) -> Self

Computes the bitwise AND of two FixedBytes.

source

pub const fn bit_or(self, rhs: Self) -> Self

Computes the bitwise OR of two FixedBytes.

source

pub const fn bit_xor(self, rhs: Self) -> Self

Computes the bitwise XOR of two FixedBytes.

Methods from Deref<Target = [u8; N]>§

1.57.0 · source

pub fn as_slice(&self) -> &[T]

Returns a slice containing the entire array. Equivalent to &s[..].

1.57.0 · source

pub fn as_mut_slice(&mut self) -> &mut [T]

Returns a mutable slice containing the entire array. Equivalent to &mut s[..].

source

pub fn each_ref(&self) -> [&T; N]

🔬This is a nightly-only experimental API. (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);
source

pub fn each_mut(&mut self) -> [&mut T; N]

🔬This is a nightly-only experimental API. (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]);
source

pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])

🔬This is a nightly-only experimental API. (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, &[]);
}
source

pub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])

🔬This is a nightly-only experimental API. (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]);
source

pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])

🔬This is a nightly-only experimental API. (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]);
}
source

pub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])

🔬This is a nightly-only experimental API. (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]);
source

pub fn as_ascii(&self) -> Option<&[AsciiChar; N]>

🔬This is a nightly-only experimental API. (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");
source

pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar; N]

🔬This is a nightly-only experimental API. (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<const N: usize> AsMut<[u8]> for FixedBytes<N>

source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<const N: usize> AsMut<[u8; N]> for FixedBytes<N>

source§

fn as_mut(&mut self) -> &mut [u8; N]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<FixedBytes<20>> for Address

source§

fn as_mut(&mut self) -> &mut FixedBytes<20>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<FixedBytes<24>> for Function

source§

fn as_mut(&mut self) -> &mut FixedBytes<24>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<FixedBytes<256>> for Bloom

source§

fn as_mut(&mut self) -> &mut FixedBytes<256>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<const N: usize> AsRef<[u8]> for FixedBytes<N>

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<const N: usize> AsRef<[u8; N]> for FixedBytes<N>

source§

fn as_ref(&self) -> &[u8; N]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<FixedBytes<20>> for Address

source§

fn as_ref(&self) -> &FixedBytes<20>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<FixedBytes<24>> for Function

source§

fn as_ref(&self) -> &FixedBytes<24>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<FixedBytes<256>> for Bloom

source§

fn as_ref(&self) -> &FixedBytes<256>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<const N: usize> BitAnd<FixedBytes<N>> for FixedBytes<N>

§

type Output = FixedBytes<N>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
source§

impl<const N: usize> BitAndAssign<FixedBytes<N>> for FixedBytes<N>

source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
source§

impl<const N: usize> BitOr<FixedBytes<N>> for FixedBytes<N>

§

type Output = FixedBytes<N>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
source§

impl<const N: usize> BitOrAssign<FixedBytes<N>> for FixedBytes<N>

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl<const N: usize> BitXor<FixedBytes<N>> for FixedBytes<N>

§

type Output = FixedBytes<N>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
source§

impl<const N: usize> BitXorAssign<FixedBytes<N>> for FixedBytes<N>

source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
source§

impl<const N: usize> Borrow<[u8]> for &FixedBytes<N>

source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
source§

impl<const N: usize> Borrow<[u8]> for &mut FixedBytes<N>

source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
source§

impl<const N: usize> Borrow<[u8]> for FixedBytes<N>

source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
source§

impl<const N: usize> Borrow<[u8; N]> for &FixedBytes<N>

source§

fn borrow(&self) -> &[u8; N]

Immutably borrows from an owned value. Read more
source§

impl<const N: usize> Borrow<[u8; N]> for &mut FixedBytes<N>

source§

fn borrow(&self) -> &[u8; N]

Immutably borrows from an owned value. Read more
source§

impl<const N: usize> Borrow<[u8; N]> for FixedBytes<N>

source§

fn borrow(&self) -> &[u8; N]

Immutably borrows from an owned value. Read more
source§

impl<const N: usize> BorrowMut<[u8]> for &mut FixedBytes<N>

source§

fn borrow_mut(&mut self) -> &mut [u8]

Mutably borrows from an owned value. Read more
source§

impl<const N: usize> BorrowMut<[u8]> for FixedBytes<N>

source§

fn borrow_mut(&mut self) -> &mut [u8]

Mutably borrows from an owned value. Read more
source§

impl<const N: usize> BorrowMut<[u8; N]> for &mut FixedBytes<N>

source§

fn borrow_mut(&mut self) -> &mut [u8; N]

Mutably borrows from an owned value. Read more
source§

impl<const N: usize> BorrowMut<[u8; N]> for FixedBytes<N>

source§

fn borrow_mut(&mut self) -> &mut [u8; N]

Mutably borrows from an owned value. Read more
source§

impl<const N: usize> Clone for FixedBytes<N>

source§

fn clone(&self) -> FixedBytes<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const N: usize> Debug for FixedBytes<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, const N: usize> Default for &'a FixedBytes<N>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<const N: usize> Default for FixedBytes<N>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<const N: usize> Deref for FixedBytes<N>

§

type Target = [u8; N]

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<const N: usize> DerefMut for FixedBytes<N>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<const N: usize> Display for FixedBytes<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const N: usize> From<&[u8; N]> for FixedBytes<N>

source§

fn from(bytes: &[u8; N]) -> Self

Converts to this type from the input type.
source§

impl<'a, const N: usize> From<&'a [u8; N]> for &'a FixedBytes<N>

source§

fn from(value: &'a [u8; N]) -> &'a FixedBytes<N>

Converts to this type from the input type.
source§

impl<'a, const N: usize> From<&'a FixedBytes<N>> for &'a [u8; N]

source§

fn from(value: &'a FixedBytes<N>) -> &'a [u8; N]

Converts to this type from the input type.
source§

impl<'a, const N: usize> From<&'a mut [u8; N]> for &'a FixedBytes<N>

source§

fn from(value: &'a mut [u8; N]) -> &'a FixedBytes<N>

Converts to this type from the input type.
source§

impl<'a, const N: usize> From<&'a mut [u8; N]> for &'a mut FixedBytes<N>

source§

fn from(value: &'a mut [u8; N]) -> &'a mut FixedBytes<N>

Converts to this type from the input type.
source§

impl<'a, const N: usize> From<&'a mut FixedBytes<N>> for &'a [u8; N]

source§

fn from(value: &'a mut FixedBytes<N>) -> &'a [u8; N]

Converts to this type from the input type.
source§

impl<'a, const N: usize> From<&'a mut FixedBytes<N>> for &'a mut [u8; N]

source§

fn from(value: &'a mut FixedBytes<N>) -> &'a mut [u8; N]

Converts to this type from the input type.
source§

impl<const N: usize> From<&mut [u8; N]> for FixedBytes<N>

source§

fn from(bytes: &mut [u8; N]) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<[u8; N]> for FixedBytes<N>

source§

fn from(original: [u8; N]) -> FixedBytes<N>

Converts to this type from the input type.
source§

impl From<Address> for FixedBytes<20>

source§

fn from(original: Address) -> Self

Converts to this type from the input type.
source§

impl From<Bloom> for FixedBytes<256>

source§

fn from(original: Bloom) -> Self

Converts to this type from the input type.
source§

impl From<FixedBytes<1>> for I8

source§

fn from(value: B8) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<1>> for U8

source§

fn from(value: B8) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<1>> for i8

source§

fn from(value: B8) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<1>> for u8

source§

fn from(value: B8) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<16>> for I128

source§

fn from(value: B128) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<16>> for U128

source§

fn from(value: B128) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<16>> for i128

source§

fn from(value: B128) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<16>> for u128

source§

fn from(value: B128) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<2>> for I16

source§

fn from(value: B16) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<2>> for U16

source§

fn from(value: B16) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<2>> for i16

source§

fn from(value: B16) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<2>> for u16

source§

fn from(value: B16) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<20>> for Address

source§

fn from(original: FixedBytes<20>) -> Address

Converts to this type from the input type.
source§

impl From<FixedBytes<20>> for I160

source§

fn from(value: B160) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<20>> for U160

source§

fn from(value: B160) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<24>> for Function

source§

fn from(original: FixedBytes<24>) -> Function

Converts to this type from the input type.
source§

impl From<FixedBytes<256>> for Bloom

source§

fn from(original: FixedBytes<256>) -> Bloom

Converts to this type from the input type.
source§

impl From<FixedBytes<32>> for I256

source§

fn from(value: B256) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<32>> for U256

source§

fn from(value: B256) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<4>> for I32

source§

fn from(value: B32) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<4>> for U32

source§

fn from(value: B32) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<4>> for i32

source§

fn from(value: B32) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<4>> for u32

source§

fn from(value: B32) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<64>> for I512

source§

fn from(value: B512) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<64>> for U512

source§

fn from(value: B512) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<8>> for I64

source§

fn from(value: B64) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<8>> for U64

source§

fn from(value: B64) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<8>> for i64

source§

fn from(value: B64) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl From<FixedBytes<8>> for u64

source§

fn from(value: B64) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

source§

impl<const N: usize> From<FixedBytes<N>> for [u8; N]

source§

fn from(s: FixedBytes<N>) -> Self

Converts to this type from the input type.
source§

impl From<Function> for FixedBytes<24>

source§

fn from(original: Function) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> FromHex for FixedBytes<N>

§

type Error = FromHexError

The associated error which can be returned from parsing.
source§

fn from_hex<T>(hex: T) -> Result<Self, Self::Error>where T: AsRef<[u8]>,

Creates an instance of type Self from the given hex string, or fails with a custom error type. Read more
source§

impl<const N: usize> FromStr for FixedBytes<N>

§

type Err = FromHexError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl<const N: usize> Hash for FixedBytes<N>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<__IdxT, const N: usize> Index<__IdxT> for FixedBytes<N>where [u8; N]: Index<__IdxT>,

§

type Output = <[u8; N] as Index<__IdxT>>::Output

The returned type after indexing.
source§

fn index(&self, idx: __IdxT) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<__IdxT, const N: usize> IndexMut<__IdxT> for FixedBytes<N>where [u8; N]: IndexMut<__IdxT>,

source§

fn index_mut(&mut self, idx: __IdxT) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime FixedBytes<N>

§

type Item = <&'__deriveMoreLifetime [u8; N] as IntoIterator>::Item

The type of the elements being iterated over.
§

type IntoIter = <&'__deriveMoreLifetime [u8; N] as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime mut FixedBytes<N>

§

type Item = <&'__deriveMoreLifetime mut [u8; N] as IntoIterator>::Item

The type of the elements being iterated over.
§

type IntoIter = <&'__deriveMoreLifetime mut [u8; N] as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<const N: usize> IntoIterator for FixedBytes<N>

§

type Item = <[u8; N] as IntoIterator>::Item

The type of the elements being iterated over.
§

type IntoIter = <[u8; N] as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<const N: usize> LowerHex for FixedBytes<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<const N: usize> Ord for FixedBytes<N>

source§

fn cmp(&self, other: &FixedBytes<N>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<const N: usize> PartialEq<&[u8]> for FixedBytes<N>

source§

fn eq(&self, other: &&[u8]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<&[u8; N]> for FixedBytes<N>

source§

fn eq(&self, other: &&[u8; N]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8]

source§

fn eq(&self, other: &&FixedBytes<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8; N]

source§

fn eq(&self, other: &&FixedBytes<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<[u8]> for &FixedBytes<N>

source§

fn eq(&self, other: &[u8]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<[u8]> for FixedBytes<N>

source§

fn eq(&self, other: &[u8]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<[u8; N]> for &FixedBytes<N>

source§

fn eq(&self, other: &[u8; N]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<[u8; N]> for FixedBytes<N>

source§

fn eq(&self, other: &[u8; N]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8]

source§

fn eq(&self, other: &FixedBytes<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8; N]

source§

fn eq(&self, other: &FixedBytes<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<FixedBytes<N>> for [u8]

source§

fn eq(&self, other: &FixedBytes<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<FixedBytes<N>> for [u8; N]

source§

fn eq(&self, other: &FixedBytes<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialEq<FixedBytes<N>> for FixedBytes<N>

source§

fn eq(&self, other: &FixedBytes<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> PartialOrd<&[u8]> for FixedBytes<N>

source§

fn partial_cmp(&self, other: &&[u8]) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const N: usize> PartialOrd<&FixedBytes<N>> for [u8]

source§

fn partial_cmp(&self, other: &&FixedBytes<N>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const N: usize> PartialOrd<[u8]> for &FixedBytes<N>

source§

fn partial_cmp(&self, other: &[u8]) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const N: usize> PartialOrd<[u8]> for FixedBytes<N>

source§

fn partial_cmp(&self, other: &[u8]) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const N: usize> PartialOrd<FixedBytes<N>> for &[u8]

source§

fn partial_cmp(&self, other: &FixedBytes<N>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const N: usize> PartialOrd<FixedBytes<N>> for [u8]

source§

fn partial_cmp(&self, other: &FixedBytes<N>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const N: usize> PartialOrd<FixedBytes<N>> for FixedBytes<N>

source§

fn partial_cmp(&self, other: &FixedBytes<N>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

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.

§

type Error = TryFromSliceError

The type returned in the event of a conversion error.
source§

fn try_from(slice: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
source§

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

The type returned in the event of a conversion error.
source§

fn try_from(slice: &'a [u8]) -> Result<&'a FixedBytes<N>, Self::Error>

Performs the conversion.
source§

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

The type returned in the event of a conversion error.
source§

fn try_from(slice: &'a mut [u8]) -> Result<&'a mut FixedBytes<N>, Self::Error>

Performs the conversion.
source§

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.

§

type Error = TryFromSliceError

The type returned in the event of a conversion error.
source§

fn try_from(slice: &mut [u8]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const N: usize> UpperHex for FixedBytes<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<const N: usize> Copy for FixedBytes<N>

source§

impl<const N: usize> Eq for FixedBytes<N>

source§

impl<const N: usize> StructuralEq for FixedBytes<N>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToHex for Twhere T: AsRef<[u8]>,

source§

fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,

👎Deprecated: use encode or other specialized functions instead
Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
source§

fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,

👎Deprecated: use encode or other specialized functions instead
Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.