Struct FixedBytes
#[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§
§impl<const N: usize> FixedBytes<N>
impl<const N: usize> FixedBytes<N>
pub const ZERO: FixedBytes<N> = _
pub const ZERO: FixedBytes<N> = _
Array of Zero bytes.
pub const fn new(bytes: [u8; N]) -> FixedBytes<N>
pub const fn new(bytes: [u8; N]) -> FixedBytes<N>
Wraps the given byte array in FixedBytes
.
pub const fn with_last_byte(x: u8) -> FixedBytes<N>
pub const fn with_last_byte(x: u8) -> FixedBytes<N>
Creates a new FixedBytes
with the last byte set to x
.
pub const fn repeat_byte(byte: u8) -> FixedBytes<N>
pub const fn repeat_byte(byte: u8) -> FixedBytes<N>
Creates a new FixedBytes
where all bytes are set to byte
.
pub fn random() -> FixedBytes<N>
Available on crate feature getrandom
only.
pub fn random() -> FixedBytes<N>
getrandom
only.Creates a new FixedBytes
with cryptographically random content.
§Panics
Panics if the underlying call to
getrandom_uninit
fails.
pub fn try_random() -> Result<FixedBytes<N>, Error>
Available on crate feature getrandom
only.
pub fn try_random() -> Result<FixedBytes<N>, Error>
getrandom
only.Tries to create a new FixedBytes
with cryptographically random
content.
§Errors
This function only propagates the error from the underlying call to
getrandom_uninit
.
pub fn random_with<R>(rng: &mut R) -> FixedBytes<N>
Available on crate feature rand
only.
pub fn random_with<R>(rng: &mut R) -> FixedBytes<N>
rand
only.Creates a new FixedBytes
with the given random number generator.
pub fn randomize(&mut self)
Available on crate feature getrandom
only.
pub fn randomize(&mut self)
getrandom
only.Fills this FixedBytes
with cryptographically random content.
§Panics
Panics if the underlying call to
getrandom_uninit
fails.
pub fn try_randomize(&mut self) -> Result<(), Error>
Available on crate feature getrandom
only.
pub fn try_randomize(&mut self) -> Result<(), Error>
getrandom
only.Tries to fill this FixedBytes
with cryptographically random content.
§Errors
This function only propagates the error from the underlying call to
getrandom_uninit
.
pub fn randomize_with<R>(&mut self, rng: &mut R)
Available on crate feature rand
only.
pub fn randomize_with<R>(&mut self, rng: &mut R)
rand
only.Fills this FixedBytes
with the given random number generator.
pub 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
.
pub fn from_slice(src: &[u8]) -> FixedBytes<N>
pub fn from_slice(src: &[u8]) -> FixedBytes<N>
Create a new FixedBytes
from the given slice src
.
For a fallible version, use the TryFrom<&[u8]>
implementation.
§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.
pub fn left_padding_from(value: &[u8]) -> FixedBytes<N>
pub fn left_padding_from(value: &[u8]) -> FixedBytes<N>
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
.
pub fn right_padding_from(value: &[u8]) -> FixedBytes<N>
pub fn right_padding_from(value: &[u8]) -> FixedBytes<N>
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
.
pub const fn as_slice(&self) -> &[u8] ⓘ
pub const fn as_slice(&self) -> &[u8] ⓘ
Returns a slice containing the entire array. Equivalent to &s[..]
.
pub 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[..]
.
pub fn covers(&self, other: &FixedBytes<N>) -> bool
pub fn covers(&self, other: &FixedBytes<N>) -> bool
Returns true
if all bits set in self
are also set in b
.
pub const fn const_covers(self, other: FixedBytes<N>) -> bool
pub const fn const_covers(self, other: FixedBytes<N>) -> bool
Returns true
if all bits set in self
are also set in b
.
pub const fn const_eq(&self, other: &FixedBytes<N>) -> bool
pub const fn const_eq(&self, other: &FixedBytes<N>) -> bool
Compile-time equality. NOT constant-time equality.
pub const fn const_is_zero(&self) -> bool
pub const fn const_is_zero(&self) -> bool
Returns true
if no bits are set.
pub const fn bit_and(self, rhs: FixedBytes<N>) -> FixedBytes<N>
pub const fn bit_and(self, rhs: FixedBytes<N>) -> FixedBytes<N>
Computes the bitwise AND of two FixedBytes
.
pub const fn bit_or(self, rhs: FixedBytes<N>) -> FixedBytes<N>
pub const fn bit_or(self, rhs: FixedBytes<N>) -> FixedBytes<N>
Computes the bitwise OR of two FixedBytes
.
pub const fn bit_xor(self, rhs: FixedBytes<N>) -> FixedBytes<N>
pub const fn bit_xor(self, rhs: FixedBytes<N>) -> FixedBytes<N>
Computes the bitwise XOR of two FixedBytes
.
Methods from Deref<Target = [u8; N]>§
Sourcepub fn as_ascii(&self) -> Option<&[AsciiChar; N]>
🔬This is a nightly-only experimental API. (ascii_char
#110998)
pub fn as_ascii(&self) -> Option<&[AsciiChar; N]>
ascii_char
#110998)Converts this array of bytes into an array of ASCII characters,
or returns None
if any of the characters is non-ASCII.
§Examples
#![feature(ascii_char)]
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
#110998)
pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar; N]
ascii_char
#110998)Converts this array of bytes into an 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.
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[..]
.
1.77.0 · Sourcepub fn each_ref(&self) -> [&T; N]
pub fn each_ref(&self) -> [&T; N]
Borrows each element and returns an array of references with the same
size as self
.
§Example
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
.
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);
1.77.0 · Sourcepub fn each_mut(&mut self) -> [&mut T; N]
pub fn each_mut(&mut self) -> [&mut T; N]
Borrows each element mutably and returns an array of mutable references
with the same size as self
.
§Example
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
#90091)
pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])
split_array
#90091)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
#90091)
pub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])
split_array
#90091)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
#90091)
pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])
split_array
#90091)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
#90091)
pub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])
split_array
#90091)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]);
Trait Implementations§
§impl<'arbitrary, const N: usize> Arbitrary<'arbitrary> for FixedBytes<N>
impl<'arbitrary, const N: usize> Arbitrary<'arbitrary> for FixedBytes<N>
§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<FixedBytes<N>, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<FixedBytes<N>, Error>
Self
from the given unstructured data. Read more§fn arbitrary_take_rest(
u: Unstructured<'arbitrary>,
) -> Result<FixedBytes<N>, Error>
fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<FixedBytes<N>, Error>
Self
from the entirety of the given
unstructured data. Read more§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read more§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read more§impl<const N: usize> Arbitrary for FixedBytes<N>
impl<const N: usize> Arbitrary for FixedBytes<N>
§type Parameters = <[u8; N] as Arbitrary>::Parameters
type Parameters = <[u8; N] as Arbitrary>::Parameters
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Map<<[u8; N] as Arbitrary>::Strategy, fn(_: [u8; N]) -> FixedBytes<N>>
type Strategy = Map<<[u8; N] as Arbitrary>::Strategy, fn(_: [u8; N]) -> FixedBytes<N>>
Strategy
used to generate values of type Self
.§fn arbitrary_with(
_top: <FixedBytes<N> as Arbitrary>::Parameters,
) -> <FixedBytes<N> as Arbitrary>::Strategy
fn arbitrary_with( _top: <FixedBytes<N> as Arbitrary>::Parameters, ) -> <FixedBytes<N> as Arbitrary>::Strategy
§impl<const N: usize> AsMut<[u8]> for FixedBytes<N>
impl<const N: usize> AsMut<[u8]> for FixedBytes<N>
§impl AsMut<FixedBytes<20>> for Address
impl AsMut<FixedBytes<20>> for Address
§fn as_mut(&mut self) -> &mut FixedBytes<20>
fn as_mut(&mut self) -> &mut FixedBytes<20>
§impl AsMut<FixedBytes<24>> for Function
impl AsMut<FixedBytes<24>> for Function
§fn as_mut(&mut self) -> &mut FixedBytes<24>
fn as_mut(&mut self) -> &mut FixedBytes<24>
§impl AsMut<FixedBytes<256>> for Bloom
impl AsMut<FixedBytes<256>> for Bloom
§fn as_mut(&mut self) -> &mut FixedBytes<256>
fn as_mut(&mut self) -> &mut FixedBytes<256>
§impl<const N: usize> AsRef<[u8]> for FixedBytes<N>
impl<const N: usize> AsRef<[u8]> for FixedBytes<N>
§impl AsRef<FixedBytes<20>> for Address
impl AsRef<FixedBytes<20>> for Address
§fn as_ref(&self) -> &FixedBytes<20>
fn as_ref(&self) -> &FixedBytes<20>
§impl AsRef<FixedBytes<24>> for Function
impl AsRef<FixedBytes<24>> for Function
§fn as_ref(&self) -> &FixedBytes<24>
fn as_ref(&self) -> &FixedBytes<24>
§impl AsRef<FixedBytes<256>> for Bloom
impl AsRef<FixedBytes<256>> for Bloom
§fn as_ref(&self) -> &FixedBytes<256>
fn as_ref(&self) -> &FixedBytes<256>
Source§impl AsRef<FixedBytes<32>> for ForkchoiceStateHash
impl AsRef<FixedBytes<32>> for ForkchoiceStateHash
Source§fn as_ref(&self) -> &FixedBytes<32>
fn as_ref(&self) -> &FixedBytes<32>
§impl AsRef<FixedBytes<32>> for RpcBlockHash
impl AsRef<FixedBytes<32>> for RpcBlockHash
§fn as_ref(&self) -> &FixedBytes<32>
fn as_ref(&self) -> &FixedBytes<32>
§impl AsRef<FixedBytes<32>> for WordToken
impl AsRef<FixedBytes<32>> for WordToken
§fn as_ref(&self) -> &FixedBytes<32>
fn as_ref(&self) -> &FixedBytes<32>
§impl<const N: usize> BitAnd for FixedBytes<N>
impl<const N: usize> BitAnd for FixedBytes<N>
§type Output = FixedBytes<N>
type Output = FixedBytes<N>
&
operator.§fn bitand(self, rhs: FixedBytes<N>) -> <FixedBytes<N> as BitAnd>::Output
fn bitand(self, rhs: FixedBytes<N>) -> <FixedBytes<N> as BitAnd>::Output
&
operation. Read more§impl<const N: usize> BitAndAssign for FixedBytes<N>
impl<const N: usize> BitAndAssign for FixedBytes<N>
§fn bitand_assign(&mut self, rhs: FixedBytes<N>)
fn bitand_assign(&mut self, rhs: FixedBytes<N>)
&=
operation. Read more§impl<const N: usize> BitOr for FixedBytes<N>
impl<const N: usize> BitOr for FixedBytes<N>
§type Output = FixedBytes<N>
type Output = FixedBytes<N>
|
operator.§fn bitor(self, rhs: FixedBytes<N>) -> <FixedBytes<N> as BitOr>::Output
fn bitor(self, rhs: FixedBytes<N>) -> <FixedBytes<N> as BitOr>::Output
|
operation. Read more§impl<const N: usize> BitOrAssign for FixedBytes<N>
impl<const N: usize> BitOrAssign for FixedBytes<N>
§fn bitor_assign(&mut self, rhs: FixedBytes<N>)
fn bitor_assign(&mut self, rhs: FixedBytes<N>)
|=
operation. Read more§impl<const N: usize> BitXor for FixedBytes<N>
impl<const N: usize> BitXor for FixedBytes<N>
§type Output = FixedBytes<N>
type Output = FixedBytes<N>
^
operator.§fn bitxor(self, rhs: FixedBytes<N>) -> <FixedBytes<N> as BitXor>::Output
fn bitxor(self, rhs: FixedBytes<N>) -> <FixedBytes<N> as BitXor>::Output
^
operation. Read more§impl<const N: usize> BitXorAssign for FixedBytes<N>
impl<const N: usize> BitXorAssign for FixedBytes<N>
§fn bitxor_assign(&mut self, rhs: FixedBytes<N>)
fn bitxor_assign(&mut self, rhs: FixedBytes<N>)
^=
operation. Read more§impl<const N: usize> Borrow<[u8]> for &FixedBytes<N>
impl<const N: usize> Borrow<[u8]> for &FixedBytes<N>
§impl<const N: usize> Borrow<[u8]> for &mut FixedBytes<N>
impl<const N: usize> Borrow<[u8]> for &mut FixedBytes<N>
§impl<const N: usize> Borrow<[u8]> for FixedBytes<N>
impl<const N: usize> Borrow<[u8]> for FixedBytes<N>
§impl<const N: usize> BorrowMut<[u8]> for &mut FixedBytes<N>
impl<const N: usize> BorrowMut<[u8]> for &mut FixedBytes<N>
§fn borrow_mut(&mut self) -> &mut [u8] ⓘ
fn borrow_mut(&mut self) -> &mut [u8] ⓘ
§impl<const N: usize> BorrowMut<[u8]> for FixedBytes<N>
impl<const N: usize> BorrowMut<[u8]> for FixedBytes<N>
§fn borrow_mut(&mut self) -> &mut [u8] ⓘ
fn borrow_mut(&mut self) -> &mut [u8] ⓘ
§impl<const N: usize> BorrowMut<[u8; N]> for &mut FixedBytes<N>
impl<const N: usize> BorrowMut<[u8; N]> for &mut FixedBytes<N>
§fn borrow_mut(&mut self) -> &mut [u8; N]
fn borrow_mut(&mut self) -> &mut [u8; N]
§impl<const N: usize> BorrowMut<[u8; N]> for FixedBytes<N>
impl<const N: usize> BorrowMut<[u8; N]> for FixedBytes<N>
§fn borrow_mut(&mut self) -> &mut [u8; N]
fn borrow_mut(&mut self) -> &mut [u8; N]
§impl<const N: usize> Clone for FixedBytes<N>
impl<const N: usize> Clone for FixedBytes<N>
§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 more§impl<const N: usize> Compact for FixedBytes<N>
impl<const N: usize> Compact for FixedBytes<N>
§fn to_compact<B>(&self, buf: &mut B) -> usize
fn to_compact<B>(&self, buf: &mut B) -> usize
§fn from_compact(buf: &[u8], len: usize) -> (FixedBytes<N>, &[u8])
fn from_compact(buf: &[u8], len: usize) -> (FixedBytes<N>, &[u8])
buf
with its internal cursor
advanced (eg..advance(len)
). Read more§fn specialized_to_compact<B>(&self, buf: &mut B) -> usize
fn specialized_to_compact<B>(&self, buf: &mut B) -> usize
§fn specialized_from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
fn specialized_from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
§impl Compress for FixedBytes<32>
impl Compress for FixedBytes<32>
§type Compressed = Vec<u8>
type Compressed = Vec<u8>
§fn uncompressable_ref(&self) -> Option<&[u8]>
fn uncompressable_ref(&self) -> Option<&[u8]>
Some(self.as_ref())
§fn compress_to_buf<B>(self, buf: &mut B)
fn compress_to_buf<B>(self, buf: &mut B)
§impl<const N: usize> Debug for FixedBytes<N>
impl<const N: usize> Debug for FixedBytes<N>
§impl<const N: usize> Decodable for FixedBytes<N>
impl<const N: usize> Decodable for FixedBytes<N>
§fn decode(buf: &mut &[u8]) -> Result<FixedBytes<N>, Error>
fn decode(buf: &mut &[u8]) -> Result<FixedBytes<N>, Error>
buf
must be advanced past
the decoded object.§impl Decode for FixedBytes<32>
impl Decode for FixedBytes<32>
§fn decode(value: &[u8]) -> Result<FixedBytes<32>, DatabaseError>
fn decode(value: &[u8]) -> Result<FixedBytes<32>, DatabaseError>
§fn decode_owned(value: Vec<u8>) -> Result<Self, DatabaseError>
fn decode_owned(value: Vec<u8>) -> Result<Self, DatabaseError>
§impl<const N: usize> Decode for FixedBytes<N>
impl<const N: usize> Decode for FixedBytes<N>
§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true
if this object has a fixed-length. Read more§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
§fn from_ssz_bytes(bytes: &[u8]) -> Result<FixedBytes<N>, DecodeError>
fn from_ssz_bytes(bytes: &[u8]) -> Result<FixedBytes<N>, DecodeError>
§impl Decompress for FixedBytes<32>
impl Decompress for FixedBytes<32>
§fn decompress(value: &[u8]) -> Result<FixedBytes<32>, DatabaseError>
fn decompress(value: &[u8]) -> Result<FixedBytes<32>, DatabaseError>
§fn decompress_owned(value: Vec<u8>) -> Result<Self, DatabaseError>
fn decompress_owned(value: Vec<u8>) -> Result<Self, DatabaseError>
§impl<const N: usize> Default for &FixedBytes<N>
impl<const N: usize> Default for &FixedBytes<N>
§fn default() -> &FixedBytes<N>
fn default() -> &FixedBytes<N>
§impl<const N: usize> Default for FixedBytes<N>
impl<const N: usize> Default for FixedBytes<N>
§fn default() -> FixedBytes<N>
fn default() -> FixedBytes<N>
§impl<const N: usize> Deref for FixedBytes<N>
impl<const N: usize> Deref for FixedBytes<N>
§impl<const N: usize> DerefMut for FixedBytes<N>
impl<const N: usize> DerefMut for FixedBytes<N>
§fn deref_mut(&mut self) -> &mut <FixedBytes<N> as Deref>::Target
fn deref_mut(&mut self) -> &mut <FixedBytes<N> as Deref>::Target
§impl<'de, const N: usize> Deserialize<'de> for FixedBytes<N>
impl<'de, const N: usize> Deserialize<'de> for FixedBytes<N>
§fn deserialize<D>(
deserializer: D,
) -> Result<FixedBytes<N>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<FixedBytes<N>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl<const N: usize> Display for FixedBytes<N>
impl<const N: usize> Display for FixedBytes<N>
§impl<const N: usize> Distribution<FixedBytes<N>> for Standard
Available on crate feature rand
only.
impl<const N: usize> Distribution<FixedBytes<N>> for Standard
rand
only.§fn sample<R>(&self, rng: &mut R) -> FixedBytes<N>
fn sample<R>(&self, rng: &mut R) -> FixedBytes<N>
T
, using rng
as the source of randomness.§impl<const N: usize> Encodable for FixedBytes<N>
impl<const N: usize> Encodable for FixedBytes<N>
§impl Encode for FixedBytes<32>
impl Encode for FixedBytes<32>
§impl<const N: usize> Encode for FixedBytes<N>
impl<const N: usize> Encode for FixedBytes<N>
§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true
if this object has a fixed-length. Read more§fn ssz_bytes_len(&self) -> usize
fn ssz_bytes_len(&self) -> usize
self
is serialized. Read more§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
§fn ssz_append(&self, buf: &mut Vec<u8>)
fn ssz_append(&self, buf: &mut Vec<u8>)
§impl<'a, const N: usize> From<&'a [u8; N]> for &'a FixedBytes<N>
impl<'a, const N: usize> From<&'a [u8; N]> for &'a FixedBytes<N>
§fn from(value: &'a [u8; N]) -> &'a FixedBytes<N>
fn from(value: &'a [u8; N]) -> &'a FixedBytes<N>
§impl<const N: usize> From<&[u8; N]> for FixedBytes<N>
impl<const N: usize> From<&[u8; N]> for FixedBytes<N>
§fn from(bytes: &[u8; N]) -> FixedBytes<N>
fn from(bytes: &[u8; N]) -> FixedBytes<N>
§impl From<&FixedBytes<32>> for HashOrNumber
impl From<&FixedBytes<32>> for HashOrNumber
§fn from(value: &FixedBytes<32>) -> HashOrNumber
fn from(value: &FixedBytes<32>) -> HashOrNumber
§impl<'a, const N: usize> From<&'a FixedBytes<N>> for &'a [u8; N]
impl<'a, const N: usize> From<&'a FixedBytes<N>> for &'a [u8; N]
§fn from(value: &'a FixedBytes<N>) -> &'a [u8; N]
fn from(value: &'a FixedBytes<N>) -> &'a [u8; N]
§impl<const N: usize> From<&'static FixedBytes<N>> for Bytes
impl<const N: usize> From<&'static FixedBytes<N>> for Bytes
§fn from(value: &'static FixedBytes<N>) -> Bytes
fn from(value: &'static FixedBytes<N>) -> Bytes
§impl<'a, const N: usize> From<&'a mut [u8; N]> for &'a FixedBytes<N>
impl<'a, const N: usize> From<&'a mut [u8; N]> for &'a FixedBytes<N>
§fn from(value: &'a mut [u8; N]) -> &'a FixedBytes<N>
fn from(value: &'a mut [u8; N]) -> &'a FixedBytes<N>
§impl<'a, const N: usize> From<&'a mut [u8; N]> for &'a mut FixedBytes<N>
impl<'a, const N: usize> From<&'a mut [u8; N]> for &'a mut FixedBytes<N>
§fn from(value: &'a mut [u8; N]) -> &'a mut FixedBytes<N>
fn from(value: &'a mut [u8; N]) -> &'a mut FixedBytes<N>
§impl<const N: usize> From<&mut [u8; N]> for FixedBytes<N>
impl<const N: usize> From<&mut [u8; N]> for FixedBytes<N>
§fn from(bytes: &mut [u8; N]) -> FixedBytes<N>
fn from(bytes: &mut [u8; N]) -> FixedBytes<N>
§impl<'a, const N: usize> From<&'a mut FixedBytes<N>> for &'a [u8; N]
impl<'a, const N: usize> From<&'a mut FixedBytes<N>> for &'a [u8; N]
§fn from(value: &'a mut FixedBytes<N>) -> &'a [u8; N]
fn from(value: &'a mut FixedBytes<N>) -> &'a [u8; N]
§impl<'a, const N: usize> From<&'a mut FixedBytes<N>> for &'a mut [u8; N]
impl<'a, const N: usize> From<&'a mut FixedBytes<N>> for &'a mut [u8; N]
§fn from(value: &'a mut FixedBytes<N>) -> &'a mut [u8; N]
fn from(value: &'a mut FixedBytes<N>) -> &'a mut [u8; N]
§impl<const N: usize> From<[u8; N]> for FixedBytes<N>
impl<const N: usize> From<[u8; N]> for FixedBytes<N>
§fn from(value: [u8; N]) -> FixedBytes<N>
fn from(value: [u8; N]) -> FixedBytes<N>
§impl From<Address> for FixedBytes<20>
impl From<Address> for FixedBytes<20>
§fn from(value: Address) -> FixedBytes<20>
fn from(value: Address) -> FixedBytes<20>
§impl From<Bloom> for FixedBytes<256>
impl From<Bloom> for FixedBytes<256>
§fn from(value: Bloom) -> FixedBytes<256>
fn from(value: Bloom) -> FixedBytes<256>
§impl From<FixedBytes<1>> for Signed<8, 1>
impl From<FixedBytes<1>> for Signed<8, 1>
§fn from(value: FixedBytes<1>) -> Signed<8, 1>
fn from(value: FixedBytes<1>) -> Signed<8, 1>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<1>> for Uint<8, 1>
impl From<FixedBytes<1>> for Uint<8, 1>
§fn from(value: FixedBytes<1>) -> Uint<8, 1>
fn from(value: FixedBytes<1>) -> Uint<8, 1>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<1>> for i8
impl From<FixedBytes<1>> for i8
§fn from(value: FixedBytes<1>) -> i8
fn from(value: FixedBytes<1>) -> i8
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<1>> for u8
impl From<FixedBytes<1>> for u8
§fn from(value: FixedBytes<1>) -> u8
fn from(value: FixedBytes<1>) -> u8
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<16>> for Signed<128, 2>
impl From<FixedBytes<16>> for Signed<128, 2>
§fn from(value: FixedBytes<16>) -> Signed<128, 2>
fn from(value: FixedBytes<16>) -> Signed<128, 2>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<16>> for Uint<128, 2>
impl From<FixedBytes<16>> for Uint<128, 2>
§fn from(value: FixedBytes<16>) -> Uint<128, 2>
fn from(value: FixedBytes<16>) -> Uint<128, 2>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<16>> for i128
impl From<FixedBytes<16>> for i128
§fn from(value: FixedBytes<16>) -> i128
fn from(value: FixedBytes<16>) -> i128
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<16>> for u128
impl From<FixedBytes<16>> for u128
§fn from(value: FixedBytes<16>) -> u128
fn from(value: FixedBytes<16>) -> u128
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<2>> for Signed<16, 1>
impl From<FixedBytes<2>> for Signed<16, 1>
§fn from(value: FixedBytes<2>) -> Signed<16, 1>
fn from(value: FixedBytes<2>) -> Signed<16, 1>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<2>> for Uint<16, 1>
impl From<FixedBytes<2>> for Uint<16, 1>
§fn from(value: FixedBytes<2>) -> Uint<16, 1>
fn from(value: FixedBytes<2>) -> Uint<16, 1>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<2>> for i16
impl From<FixedBytes<2>> for i16
§fn from(value: FixedBytes<2>) -> i16
fn from(value: FixedBytes<2>) -> i16
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<2>> for u16
impl From<FixedBytes<2>> for u16
§fn from(value: FixedBytes<2>) -> u16
fn from(value: FixedBytes<2>) -> u16
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<20>> for Address
impl From<FixedBytes<20>> for Address
§fn from(value: FixedBytes<20>) -> Address
fn from(value: FixedBytes<20>) -> Address
§impl From<FixedBytes<20>> for Signed<160, 3>
impl From<FixedBytes<20>> for Signed<160, 3>
§fn from(value: FixedBytes<20>) -> Signed<160, 3>
fn from(value: FixedBytes<20>) -> Signed<160, 3>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<20>> for Uint<160, 3>
impl From<FixedBytes<20>> for Uint<160, 3>
§fn from(value: FixedBytes<20>) -> Uint<160, 3>
fn from(value: FixedBytes<20>) -> Uint<160, 3>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<24>> for Function
impl From<FixedBytes<24>> for Function
§fn from(value: FixedBytes<24>) -> Function
fn from(value: FixedBytes<24>) -> Function
§impl From<FixedBytes<256>> for Bloom
impl From<FixedBytes<256>> for Bloom
§fn from(value: FixedBytes<256>) -> Bloom
fn from(value: FixedBytes<256>) -> Bloom
§impl From<FixedBytes<32>> for BlockId
impl From<FixedBytes<32>> for BlockId
§fn from(block_hash: FixedBytes<32>) -> BlockId
fn from(block_hash: FixedBytes<32>) -> BlockId
Source§impl From<FixedBytes<32>> for ChainSplitTarget
impl From<FixedBytes<32>> for ChainSplitTarget
Source§fn from(hash: FixedBytes<32>) -> ChainSplitTarget
fn from(hash: FixedBytes<32>) -> ChainSplitTarget
§impl From<FixedBytes<32>> for Eip658Value
impl From<FixedBytes<32>> for Eip658Value
§fn from(state: FixedBytes<32>) -> Eip658Value
fn from(state: FixedBytes<32>) -> Eip658Value
§impl From<FixedBytes<32>> for FilterBlockOption
impl From<FixedBytes<32>> for FilterBlockOption
§fn from(hash: FixedBytes<32>) -> FilterBlockOption
fn from(hash: FixedBytes<32>) -> FilterBlockOption
§impl From<FixedBytes<32>> for ForkHash
impl From<FixedBytes<32>> for ForkHash
§fn from(genesis: FixedBytes<32>) -> ForkHash
fn from(genesis: FixedBytes<32>) -> ForkHash
§impl From<FixedBytes<32>> for HashOrNumber
impl From<FixedBytes<32>> for HashOrNumber
§fn from(value: FixedBytes<32>) -> HashOrNumber
fn from(value: FixedBytes<32>) -> HashOrNumber
§impl From<FixedBytes<32>> for JsonStorageKey
impl From<FixedBytes<32>> for JsonStorageKey
§fn from(value: FixedBytes<32>) -> JsonStorageKey
fn from(value: FixedBytes<32>) -> JsonStorageKey
§impl From<FixedBytes<32>> for PipelineTarget
impl From<FixedBytes<32>> for PipelineTarget
§fn from(hash: FixedBytes<32>) -> PipelineTarget
fn from(hash: FixedBytes<32>) -> PipelineTarget
§impl From<FixedBytes<32>> for RpcBlockHash
impl From<FixedBytes<32>> for RpcBlockHash
§fn from(value: FixedBytes<32>) -> RpcBlockHash
fn from(value: FixedBytes<32>) -> RpcBlockHash
§impl From<FixedBytes<32>> for Signed<256, 4>
impl From<FixedBytes<32>> for Signed<256, 4>
§fn from(value: FixedBytes<32>) -> Signed<256, 4>
fn from(value: FixedBytes<32>) -> Signed<256, 4>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<32>> for Uint<256, 4>
impl From<FixedBytes<32>> for Uint<256, 4>
§fn from(value: FixedBytes<32>) -> Uint<256, 4>
fn from(value: FixedBytes<32>) -> Uint<256, 4>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<32>> for WordToken
impl From<FixedBytes<32>> for WordToken
§fn from(value: FixedBytes<32>) -> WordToken
fn from(value: FixedBytes<32>) -> WordToken
§impl From<FixedBytes<4>> for Signed<32, 1>
impl From<FixedBytes<4>> for Signed<32, 1>
§fn from(value: FixedBytes<4>) -> Signed<32, 1>
fn from(value: FixedBytes<4>) -> Signed<32, 1>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<4>> for Uint<32, 1>
impl From<FixedBytes<4>> for Uint<32, 1>
§fn from(value: FixedBytes<4>) -> Uint<32, 1>
fn from(value: FixedBytes<4>) -> Uint<32, 1>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<4>> for i32
impl From<FixedBytes<4>> for i32
§fn from(value: FixedBytes<4>) -> i32
fn from(value: FixedBytes<4>) -> i32
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<4>> for u32
impl From<FixedBytes<4>> for u32
§fn from(value: FixedBytes<4>) -> u32
fn from(value: FixedBytes<4>) -> u32
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<64>> for Signed<512, 8>
impl From<FixedBytes<64>> for Signed<512, 8>
§fn from(value: FixedBytes<64>) -> Signed<512, 8>
fn from(value: FixedBytes<64>) -> Signed<512, 8>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<64>> for Uint<512, 8>
impl From<FixedBytes<64>> for Uint<512, 8>
§fn from(value: FixedBytes<64>) -> Uint<512, 8>
fn from(value: FixedBytes<64>) -> Uint<512, 8>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<8>> for Signed<64, 1>
impl From<FixedBytes<8>> for Signed<64, 1>
§fn from(value: FixedBytes<8>) -> Signed<64, 1>
fn from(value: FixedBytes<8>) -> Signed<64, 1>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<8>> for Uint<64, 1>
impl From<FixedBytes<8>> for Uint<64, 1>
§fn from(value: FixedBytes<8>) -> Uint<64, 1>
fn from(value: FixedBytes<8>) -> Uint<64, 1>
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<8>> for i64
impl From<FixedBytes<8>> for i64
§fn from(value: FixedBytes<8>) -> i64
fn from(value: FixedBytes<8>) -> i64
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl From<FixedBytes<8>> for u64
impl From<FixedBytes<8>> for u64
§fn from(value: FixedBytes<8>) -> u64
fn from(value: FixedBytes<8>) -> u64
Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.
§impl<const N: usize> From<FixedBytes<N>> for [u8; N]
impl<const N: usize> From<FixedBytes<N>> for [u8; N]
§fn from(s: FixedBytes<N>) -> [u8; N]
fn from(s: FixedBytes<N>) -> [u8; N]
§impl<const N: usize> From<FixedBytes<N>> for Bytes
impl<const N: usize> From<FixedBytes<N>> for Bytes
§fn from(value: FixedBytes<N>) -> Bytes
fn from(value: FixedBytes<N>) -> Bytes
§impl From<Function> for FixedBytes<24>
impl From<Function> for FixedBytes<24>
§fn from(value: Function) -> FixedBytes<24>
fn from(value: Function) -> FixedBytes<24>
§impl From<PropagateKind> for FixedBytes<64>
impl From<PropagateKind> for FixedBytes<64>
§fn from(value: PropagateKind) -> FixedBytes<64>
fn from(value: PropagateKind) -> FixedBytes<64>
§impl From<RpcBlockHash> for FixedBytes<32>
impl From<RpcBlockHash> for FixedBytes<32>
§fn from(value: RpcBlockHash) -> FixedBytes<32>
fn from(value: RpcBlockHash) -> FixedBytes<32>
§impl From<Signed<128, 2>> for FixedBytes<16>
impl From<Signed<128, 2>> for FixedBytes<16>
§fn from(value: Signed<128, 2>) -> FixedBytes<16>
fn from(value: Signed<128, 2>) -> FixedBytes<16>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Signed<16, 1>> for FixedBytes<2>
impl From<Signed<16, 1>> for FixedBytes<2>
§fn from(value: Signed<16, 1>) -> FixedBytes<2>
fn from(value: Signed<16, 1>) -> FixedBytes<2>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Signed<160, 3>> for FixedBytes<20>
impl From<Signed<160, 3>> for FixedBytes<20>
§fn from(value: Signed<160, 3>) -> FixedBytes<20>
fn from(value: Signed<160, 3>) -> FixedBytes<20>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Signed<256, 4>> for FixedBytes<32>
impl From<Signed<256, 4>> for FixedBytes<32>
§fn from(value: Signed<256, 4>) -> FixedBytes<32>
fn from(value: Signed<256, 4>) -> FixedBytes<32>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Signed<32, 1>> for FixedBytes<4>
impl From<Signed<32, 1>> for FixedBytes<4>
§fn from(value: Signed<32, 1>) -> FixedBytes<4>
fn from(value: Signed<32, 1>) -> FixedBytes<4>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Signed<512, 8>> for FixedBytes<64>
impl From<Signed<512, 8>> for FixedBytes<64>
§fn from(value: Signed<512, 8>) -> FixedBytes<64>
fn from(value: Signed<512, 8>) -> FixedBytes<64>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Signed<64, 1>> for FixedBytes<8>
impl From<Signed<64, 1>> for FixedBytes<8>
§fn from(value: Signed<64, 1>) -> FixedBytes<8>
fn from(value: Signed<64, 1>) -> FixedBytes<8>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Signed<8, 1>> for FixedBytes<1>
impl From<Signed<8, 1>> for FixedBytes<1>
§fn from(value: Signed<8, 1>) -> FixedBytes<1>
fn from(value: Signed<8, 1>) -> FixedBytes<1>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Uint<128, 2>> for FixedBytes<16>
impl From<Uint<128, 2>> for FixedBytes<16>
§fn from(value: Uint<128, 2>) -> FixedBytes<16>
fn from(value: Uint<128, 2>) -> FixedBytes<16>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Uint<16, 1>> for FixedBytes<2>
impl From<Uint<16, 1>> for FixedBytes<2>
§fn from(value: Uint<16, 1>) -> FixedBytes<2>
fn from(value: Uint<16, 1>) -> FixedBytes<2>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Uint<160, 3>> for FixedBytes<20>
impl From<Uint<160, 3>> for FixedBytes<20>
§fn from(value: Uint<160, 3>) -> FixedBytes<20>
fn from(value: Uint<160, 3>) -> FixedBytes<20>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Uint<256, 4>> for FixedBytes<32>
impl From<Uint<256, 4>> for FixedBytes<32>
§fn from(value: Uint<256, 4>) -> FixedBytes<32>
fn from(value: Uint<256, 4>) -> FixedBytes<32>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Uint<32, 1>> for FixedBytes<4>
impl From<Uint<32, 1>> for FixedBytes<4>
§fn from(value: Uint<32, 1>) -> FixedBytes<4>
fn from(value: Uint<32, 1>) -> FixedBytes<4>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Uint<512, 8>> for FixedBytes<64>
impl From<Uint<512, 8>> for FixedBytes<64>
§fn from(value: Uint<512, 8>) -> FixedBytes<64>
fn from(value: Uint<512, 8>) -> FixedBytes<64>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Uint<64, 1>> for FixedBytes<8>
impl From<Uint<64, 1>> for FixedBytes<8>
§fn from(value: Uint<64, 1>) -> FixedBytes<8>
fn from(value: Uint<64, 1>) -> FixedBytes<8>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<Uint<8, 1>> for FixedBytes<1>
impl From<Uint<8, 1>> for FixedBytes<1>
§fn from(value: Uint<8, 1>) -> FixedBytes<1>
fn from(value: Uint<8, 1>) -> FixedBytes<1>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<WordToken> for FixedBytes<32>
impl From<WordToken> for FixedBytes<32>
§fn from(value: WordToken) -> FixedBytes<32>
fn from(value: WordToken) -> FixedBytes<32>
§impl From<i128> for FixedBytes<16>
impl From<i128> for FixedBytes<16>
§fn from(value: i128) -> FixedBytes<16>
fn from(value: i128) -> FixedBytes<16>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<i16> for FixedBytes<2>
impl From<i16> for FixedBytes<2>
§fn from(value: i16) -> FixedBytes<2>
fn from(value: i16) -> FixedBytes<2>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<i32> for FixedBytes<4>
impl From<i32> for FixedBytes<4>
§fn from(value: i32) -> FixedBytes<4>
fn from(value: i32) -> FixedBytes<4>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<i64> for FixedBytes<8>
impl From<i64> for FixedBytes<8>
§fn from(value: i64) -> FixedBytes<8>
fn from(value: i64) -> FixedBytes<8>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<i8> for FixedBytes<1>
impl From<i8> for FixedBytes<1>
§fn from(value: i8) -> FixedBytes<1>
fn from(value: i8) -> FixedBytes<1>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<u128> for FixedBytes<16>
impl From<u128> for FixedBytes<16>
§fn from(value: u128) -> FixedBytes<16>
fn from(value: u128) -> FixedBytes<16>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<u16> for FixedBytes<2>
impl From<u16> for FixedBytes<2>
§fn from(value: u16) -> FixedBytes<2>
fn from(value: u16) -> FixedBytes<2>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<u32> for FixedBytes<4>
impl From<u32> for FixedBytes<4>
§fn from(value: u32) -> FixedBytes<4>
fn from(value: u32) -> FixedBytes<4>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<u64> for FixedBytes<8>
impl From<u64> for FixedBytes<8>
§fn from(value: u64) -> FixedBytes<8>
fn from(value: u64) -> FixedBytes<8>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl From<u8> for FixedBytes<1>
impl From<u8> for FixedBytes<1>
§fn from(value: u8) -> FixedBytes<1>
fn from(value: u8) -> FixedBytes<1>
Converts a fixed-width unsigned integer into a fixed byte array by interpreting the bytes as big-endian.
§impl<const N: usize> FromHex for FixedBytes<N>
impl<const N: usize> FromHex for FixedBytes<N>
§type Error = FromHexError
type Error = FromHexError
§fn from_hex<T>(
hex: T,
) -> Result<FixedBytes<N>, <FixedBytes<N> as FromHex>::Error>
fn from_hex<T>( hex: T, ) -> Result<FixedBytes<N>, <FixedBytes<N> as FromHex>::Error>
Self
from the given hex string, or fails
with a custom error type. Read more§impl<const N: usize> FromStr for FixedBytes<N>
impl<const N: usize> FromStr for FixedBytes<N>
§type Err = FromHexError
type Err = FromHexError
§fn from_str(s: &str) -> Result<FixedBytes<N>, <FixedBytes<N> as FromStr>::Err>
fn from_str(s: &str) -> Result<FixedBytes<N>, <FixedBytes<N> as FromStr>::Err>
s
to return a value of this type. Read more§impl<const N: usize> Hash for FixedBytes<N>
impl<const N: usize> Hash for FixedBytes<N>
§impl<__IdxT, const N: usize> Index<__IdxT> for FixedBytes<N>
impl<__IdxT, const N: usize> Index<__IdxT> for FixedBytes<N>
§impl<__IdxT, const N: usize> IndexMut<__IdxT> for FixedBytes<N>
impl<__IdxT, const N: usize> IndexMut<__IdxT> for FixedBytes<N>
§impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime FixedBytes<N>
impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime FixedBytes<N>
§type Item = <&'__deriveMoreLifetime [u8; N] as IntoIterator>::Item
type Item = <&'__deriveMoreLifetime [u8; N] as IntoIterator>::Item
§type IntoIter = <&'__deriveMoreLifetime [u8; N] as IntoIterator>::IntoIter
type IntoIter = <&'__deriveMoreLifetime [u8; N] as IntoIterator>::IntoIter
§fn into_iter(
self,
) -> <&'__deriveMoreLifetime FixedBytes<N> as IntoIterator>::IntoIter
fn into_iter( self, ) -> <&'__deriveMoreLifetime FixedBytes<N> as IntoIterator>::IntoIter
§impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime mut FixedBytes<N>
impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime mut FixedBytes<N>
§type Item = <&'__deriveMoreLifetime mut [u8; N] as IntoIterator>::Item
type Item = <&'__deriveMoreLifetime mut [u8; N] as IntoIterator>::Item
§type IntoIter = <&'__deriveMoreLifetime mut [u8; N] as IntoIterator>::IntoIter
type IntoIter = <&'__deriveMoreLifetime mut [u8; N] as IntoIterator>::IntoIter
§fn into_iter(
self,
) -> <&'__deriveMoreLifetime mut FixedBytes<N> as IntoIterator>::IntoIter
fn into_iter( self, ) -> <&'__deriveMoreLifetime mut FixedBytes<N> as IntoIterator>::IntoIter
§impl<const N: usize> IntoIterator for FixedBytes<N>
impl<const N: usize> IntoIterator for FixedBytes<N>
§type IntoIter = <[u8; N] as IntoIterator>::IntoIter
type IntoIter = <[u8; N] as IntoIterator>::IntoIter
§fn into_iter(self) -> <FixedBytes<N> as IntoIterator>::IntoIter
fn into_iter(self) -> <FixedBytes<N> as IntoIterator>::IntoIter
§impl<const N: usize> LowerHex for FixedBytes<N>
impl<const N: usize> LowerHex for FixedBytes<N>
§impl<const N: usize> Not for FixedBytes<N>
impl<const N: usize> Not for FixedBytes<N>
§type Output = FixedBytes<N>
type Output = FixedBytes<N>
!
operator.§impl<const N: usize> Ord for FixedBytes<N>
impl<const N: usize> Ord for FixedBytes<N>
§impl<const N: usize> PartialEq<&[u8]> for FixedBytes<N>
impl<const N: usize> PartialEq<&[u8]> for FixedBytes<N>
§impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8]
impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8]
§impl<const N: usize> PartialEq<[u8]> for &FixedBytes<N>
impl<const N: usize> PartialEq<[u8]> for &FixedBytes<N>
§impl<const N: usize> PartialEq<[u8]> for FixedBytes<N>
impl<const N: usize> PartialEq<[u8]> for FixedBytes<N>
§impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8]
impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8]
§impl<const N: usize> PartialEq<FixedBytes<N>> for [u8]
impl<const N: usize> PartialEq<FixedBytes<N>> for [u8]
§impl<const N: usize> PartialEq for FixedBytes<N>
impl<const N: usize> PartialEq for FixedBytes<N>
§impl<const N: usize> PartialOrd<&[u8]> for FixedBytes<N>
impl<const N: usize> PartialOrd<&[u8]> for FixedBytes<N>
§impl<const N: usize> PartialOrd<&FixedBytes<N>> for [u8]
impl<const N: usize> PartialOrd<&FixedBytes<N>> for [u8]
§impl<const N: usize> PartialOrd<[u8]> for &FixedBytes<N>
impl<const N: usize> PartialOrd<[u8]> for &FixedBytes<N>
§impl<const N: usize> PartialOrd<[u8]> for FixedBytes<N>
impl<const N: usize> PartialOrd<[u8]> for FixedBytes<N>
§impl<const N: usize> PartialOrd<FixedBytes<N>> for &[u8]
impl<const N: usize> PartialOrd<FixedBytes<N>> for &[u8]
§impl<const N: usize> PartialOrd<FixedBytes<N>> for [u8]
impl<const N: usize> PartialOrd<FixedBytes<N>> for [u8]
§impl<const N: usize> PartialOrd for FixedBytes<N>
impl<const N: usize> PartialOrd for FixedBytes<N>
§impl<const N: usize> Serialize for FixedBytes<N>
impl<const N: usize> Serialize for FixedBytes<N>
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
§impl<const N: usize> SolValue for FixedBytes<N>where
ByteCount<N>: SupportedFixedBytes,
impl<const N: usize> SolValue for FixedBytes<N>where
ByteCount<N>: SupportedFixedBytes,
§fn sol_type_name(&self) -> Cow<'static, str>
fn sol_type_name(&self) -> Cow<'static, str>
sol_name
instead§fn tokenize(&self) -> <Self::SolType as SolType>::Token<'_>
fn tokenize(&self) -> <Self::SolType as SolType>::Token<'_>
§fn detokenize(token: <Self::SolType as SolType>::Token<'_>) -> Selfwhere
Self: From<<Self::SolType as SolType>::RustType>,
fn detokenize(token: <Self::SolType as SolType>::Token<'_>) -> Selfwhere
Self: From<<Self::SolType as SolType>::RustType>,
§fn abi_encoded_size(&self) -> usize
fn abi_encoded_size(&self) -> usize
§fn eip712_data_word(&self) -> FixedBytes<32>
fn eip712_data_word(&self) -> FixedBytes<32>
encodeData
rules, and hash it
if necessary. Read more§fn abi_encode_packed_to(&self, out: &mut Vec<u8>)
fn abi_encode_packed_to(&self, out: &mut Vec<u8>)
§fn abi_encode_sequence(&self) -> Vec<u8> ⓘwhere
<Self::SolType as SolType>::Token<'a>: for<'a> TokenSeq<'a>,
fn abi_encode_sequence(&self) -> Vec<u8> ⓘwhere
<Self::SolType as SolType>::Token<'a>: for<'a> TokenSeq<'a>,
§fn abi_encode_params(&self) -> Vec<u8> ⓘwhere
<Self::SolType as SolType>::Token<'a>: for<'a> TokenSeq<'a>,
fn abi_encode_params(&self) -> Vec<u8> ⓘwhere
<Self::SolType as SolType>::Token<'a>: for<'a> TokenSeq<'a>,
§fn abi_decode(data: &[u8], validate: bool) -> Result<Self, Error>where
Self: From<<Self::SolType as SolType>::RustType>,
fn abi_decode(data: &[u8], validate: bool) -> Result<Self, Error>where
Self: From<<Self::SolType as SolType>::RustType>,
§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
§fn try_from(
slice: &'a [u8],
) -> Result<&'a FixedBytes<N>, <&'a FixedBytes<N> as TryFrom<&'a [u8]>>::Error>
fn try_from( slice: &'a [u8], ) -> Result<&'a FixedBytes<N>, <&'a FixedBytes<N> as TryFrom<&'a [u8]>>::Error>
§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
.
§type Error = TryFromSliceError
type Error = TryFromSliceError
§fn try_from(
slice: &[u8],
) -> Result<FixedBytes<N>, <FixedBytes<N> as TryFrom<&[u8]>>::Error>
fn try_from( slice: &[u8], ) -> Result<FixedBytes<N>, <FixedBytes<N> as TryFrom<&[u8]>>::Error>
§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
§fn try_from(
slice: &'a mut [u8],
) -> Result<&'a mut FixedBytes<N>, <&'a mut FixedBytes<N> as TryFrom<&'a mut [u8]>>::Error>
fn try_from( slice: &'a mut [u8], ) -> Result<&'a mut FixedBytes<N>, <&'a mut FixedBytes<N> as TryFrom<&'a mut [u8]>>::Error>
§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
.
§type Error = TryFromSliceError
type Error = TryFromSliceError
§fn try_from(
slice: &mut [u8],
) -> Result<FixedBytes<N>, <FixedBytes<N> as TryFrom<&mut [u8]>>::Error>
fn try_from( slice: &mut [u8], ) -> Result<FixedBytes<N>, <FixedBytes<N> as TryFrom<&mut [u8]>>::Error>
§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 MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#10}::{constant#0}> for FixedBytes<32>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#11}::{constant#0}> for FixedBytes<64>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#12}::{constant#0}> for FixedBytes<128>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#13}::{constant#0}> for FixedBytes<256>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#14}::{constant#0}> for FixedBytes<512>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#15}::{constant#0}> for FixedBytes<1024>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#3}::{constant#0}> for FixedBytes<0>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#4}::{constant#0}> for FixedBytes<1>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#5}::{constant#0}> for FixedBytes<2>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#6}::{constant#0}> for FixedBytes<4>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#7}::{constant#0}> for FixedBytes<8>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#8}::{constant#0}> for FixedBytes<16>
impl MaxEncodedLen<alloy_primitives::::bits::rlp::{impl#9}::{constant#0}> for FixedBytes<20>
impl<const N: usize> StructuralPartialEq for FixedBytes<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for FixedBytes<N>
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§
§impl<T, U> AsByteSlice<T> for U
impl<T, U> AsByteSlice<T> for U
fn as_byte_slice(&self) -> &[u8] ⓘ
§impl<A, T> AsMutBits<T> for A
impl<A, T> AsMutBits<T> for A
§fn as_mut_bits<O>(&mut self) -> &mut BitSlice<T, O> ⓘwhere
O: BitOrder,
fn as_mut_bits<O>(&mut self) -> &mut BitSlice<T, O> ⓘwhere
O: BitOrder,
self
as a mutable bit-slice region with the O
ordering.§fn try_as_mut_bits<O>(&mut self) -> Result<&mut BitSlice<T, O>, BitSpanError<T>>where
O: BitOrder,
fn try_as_mut_bits<O>(&mut self) -> Result<&mut BitSlice<T, O>, BitSpanError<T>>where
O: BitOrder,
§impl<T, U> AsMutByteSlice<T> for U
impl<T, U> AsMutByteSlice<T> for U
fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
§impl<U> AsMutSliceOf for U
impl<U> AsMutSliceOf for U
fn as_mut_slice_of<T>(&mut self) -> Result<&mut [T], Error>where
T: FromByteSlice,
§impl<U> AsSliceOf for U
impl<U> AsSliceOf for U
fn as_slice_of<T>(&self) -> Result<&[T], Error>where
T: FromByteSlice,
§impl<T> Base32Len for T
impl<T> Base32Len for T
§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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 more§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute
] value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
[Quirk
] value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition
] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.§impl<T> ToBase32 for T
impl<T> ToBase32 for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()
] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
]. Read more§impl<T> ToHex for T
impl<T> ToHex for T
§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
ToHexExt
insteadself
into the result.
Lower case letters are used (e.g. f9b4ca
).§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
ToHexExt
insteadself
into the result.
Upper case letters are used (e.g. F9B4CA
).Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn 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
)Source§fn 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
)§impl<T> ToHexExt for T
impl<T> ToHexExt for T
§fn encode_hex(&self) -> String
fn encode_hex(&self) -> String
self
into the result.
Lower case letters are used (e.g. f9b4ca
).§fn encode_hex_upper(&self) -> String
fn encode_hex_upper(&self) -> String
self
into the result.
Upper case letters are used (e.g. F9B4CA
).§fn encode_hex_with_prefix(&self) -> String
fn encode_hex_with_prefix(&self) -> String
self
into the result with prefix 0x
.
Lower case letters are used (e.g. 0xf9b4ca
).§fn encode_hex_upper_with_prefix(&self) -> String
fn encode_hex_upper_with_prefix(&self) -> String
self
into the result with prefix 0X
.
Upper case letters are used (e.g. 0xF9B4CA
).§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.
§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
impl<A> ArbInterop for A
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Key for T
impl<T> MaybeArbitrary for Twhere
T: for<'a> Arbitrary<'a>,
impl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSendSync for T
impl<T> NippyJarHeader for T
impl<T> NumBytes for T
impl<T> RpcObject for Twhere
T: RpcParam + RpcReturn,
impl<T> RpcParam for T
impl<T> RpcReturn for T
impl<T> Value for Twhere
T: Compress + Decompress + Serialize,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.