Struct Address
#[repr(transparent)]pub struct Address(pub FixedBytes<20>);
Expand description
An Ethereum address, 20 bytes in length.
This type is separate from B160
/ FixedBytes<20>
and is declared with the wrap_fixed_bytes!
macro. This allows us
to implement address-specific functionality.
The main difference with the generic FixedBytes
implementation is that
Display
formats the address using its EIP-55 checksum
(to_checksum
).
Use Debug
to display the raw bytes without the checksum.
§Examples
Parsing and formatting:
use alloy_primitives::{address, Address};
let checksummed = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
let expected = address!("d8da6bf26964af9d7eed9e03e53415d37aa96045");
let address = Address::parse_checksummed(checksummed, None).expect("valid checksum");
assert_eq!(address, expected);
// Format the address with the checksum
assert_eq!(address.to_string(), checksummed);
assert_eq!(address.to_checksum(None), checksummed);
// Format the compressed checksummed address
assert_eq!(format!("{address:#}"), "0xd8dA…6045");
// Format the address without the checksum
assert_eq!(format!("{address:?}"), "0xd8da6bf26964af9d7eed9e03e53415d37aa96045");
Tuple Fields§
§0: FixedBytes<20>
Implementations§
§impl Address
impl Address
pub const fn with_last_byte(x: u8) -> Address
pub const fn with_last_byte(x: u8) -> Address
Creates a new byte array with the last byte set to x
.
pub const fn repeat_byte(byte: u8) -> Address
pub const fn repeat_byte(byte: u8) -> Address
Creates a new byte array where all bytes are set to byte
.
pub fn random() -> Address
pub fn random() -> Address
Instantiates a new fixed byte array with cryptographically random content.
§Panics
Panics if the underlying call to getrandom_uninit
fails.
pub fn try_random() -> Result<Address, Error>
pub fn try_random() -> Result<Address, Error>
Tries to create a new fixed byte array with cryptographically random content.
§Errors
This function only propagates the error from the underlying call to
getrandom_uninit
.
pub fn randomize(&mut self)
pub fn randomize(&mut self)
Fills this fixed byte array with cryptographically random content.
§Panics
Panics if the underlying call to getrandom_uninit
fails.
pub fn try_randomize(&mut self) -> Result<(), Error>
pub fn try_randomize(&mut self) -> Result<(), Error>
Tries to fill this fixed byte array 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) -> Address
pub fn random_with<R>(rng: &mut R) -> Address
Creates a new fixed byte array with the given random number generator.
pub fn randomize_with<R>(&mut self, rng: &mut R)
pub fn randomize_with<R>(&mut self, rng: &mut R)
Fills this fixed byte array with the given random number generator.
pub fn from_slice(src: &[u8]) -> Address
pub fn from_slice(src: &[u8]) -> Address
pub fn left_padding_from(value: &[u8]) -> Address
pub fn left_padding_from(value: &[u8]) -> Address
pub fn right_padding_from(value: &[u8]) -> Address
pub fn right_padding_from(value: &[u8]) -> Address
pub const fn into_array(self) -> [u8; 20]
pub const fn into_array(self) -> [u8; 20]
Returns the inner bytes array.
§impl Address
impl Address
pub fn from_word(word: FixedBytes<32>) -> Address
pub fn from_word(word: FixedBytes<32>) -> Address
Creates an Ethereum address from an EVM word’s upper 20 bytes
(word[12..]
).
§Examples
let word = b256!("000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045");
assert_eq!(Address::from_word(word), address!("d8da6bf26964af9d7eed9e03e53415d37aa96045"));
pub fn into_word(&self) -> FixedBytes<32>
pub fn into_word(&self) -> FixedBytes<32>
Left-pads the address to 32 bytes (EVM word size).
§Examples
assert_eq!(
address!("d8da6bf26964af9d7eed9e03e53415d37aa96045").into_word(),
b256!("000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045"),
);
pub fn parse_checksummed<S>(
s: S,
chain_id: Option<u64>,
) -> Result<Address, AddressError>
pub fn parse_checksummed<S>( s: S, chain_id: Option<u64>, ) -> Result<Address, AddressError>
Parse an Ethereum address, verifying its EIP-55 checksum.
You can optionally specify an EIP-155 chain ID to check the address using EIP-1191.
§Errors
This method returns an error if the provided string does not match the expected checksum.
§Examples
let checksummed = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
let address = Address::parse_checksummed(checksummed, None).unwrap();
let expected = address!("d8da6bf26964af9d7eed9e03e53415d37aa96045");
assert_eq!(address, expected);
pub fn to_checksum(&self, chain_id: Option<u64>) -> String
pub fn to_checksum(&self, chain_id: Option<u64>) -> String
Encodes an Ethereum address to its EIP-55 checksum into a heap-allocated string.
You can optionally specify an EIP-155 chain ID to encode the address using EIP-1191.
§Examples
let address = address!("d8da6bf26964af9d7eed9e03e53415d37aa96045");
let checksummed: String = address.to_checksum(None);
assert_eq!(checksummed, "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
let checksummed: String = address.to_checksum(Some(1));
assert_eq!(checksummed, "0xD8Da6bf26964Af9d7EEd9e03e53415d37AA96045");
pub fn to_checksum_raw<'a>(
&self,
buf: &'a mut [u8],
chain_id: Option<u64>,
) -> &'a mut str
pub fn to_checksum_raw<'a>( &self, buf: &'a mut [u8], chain_id: Option<u64>, ) -> &'a mut str
Encodes an Ethereum address to its EIP-55 checksum into the given buffer.
For convenience, the buffer is returned as a &mut str
, as the bytes
are guaranteed to be valid UTF-8.
You can optionally specify an EIP-155 chain ID to encode the address using EIP-1191.
§Panics
Panics if buf
is not exactly 42 bytes long.
§Examples
let address = address!("d8da6bf26964af9d7eed9e03e53415d37aa96045");
let mut buf = [0; 42];
let checksummed: &mut str = address.to_checksum_raw(&mut buf, None);
assert_eq!(checksummed, "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
let checksummed: &mut str = address.to_checksum_raw(&mut buf, Some(1));
assert_eq!(checksummed, "0xD8Da6bf26964Af9d7EEd9e03e53415d37AA96045");
pub fn to_checksum_buffer(&self, chain_id: Option<u64>) -> AddressChecksumBuffer
pub fn to_checksum_buffer(&self, chain_id: Option<u64>) -> AddressChecksumBuffer
Encodes an Ethereum address to its EIP-55 checksum into a stack-allocated buffer.
You can optionally specify an EIP-155 chain ID to encode the address using EIP-1191.
§Examples
let address = address!("d8da6bf26964af9d7eed9e03e53415d37aa96045");
let mut buffer: AddressChecksumBuffer = address.to_checksum_buffer(None);
assert_eq!(buffer.as_str(), "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
let checksummed: &str = buffer.format(&address, Some(1));
assert_eq!(checksummed, "0xD8Da6bf26964Af9d7EEd9e03e53415d37AA96045");
pub fn create(&self, nonce: u64) -> Address
Available on crate feature rlp
only.
pub fn create(&self, nonce: u64) -> Address
rlp
only.Computes the create
address for this address and nonce:
keccak256(rlp([sender, nonce]))[12:]
§Examples
let sender = address!("b20a608c624Ca5003905aA834De7156C68b2E1d0");
let expected = address!("00000000219ab540356cBB839Cbe05303d7705Fa");
assert_eq!(sender.create(0), expected);
let expected = address!("e33c6e89e69d085897f98e92b06ebd541d1daa99");
assert_eq!(sender.create(1), expected);
pub fn create2_from_code<S, C>(&self, salt: S, init_code: C) -> Address
pub fn create2_from_code<S, C>(&self, salt: S, init_code: C) -> Address
Computes the CREATE2
address of a smart contract as specified in
EIP-1014:
keccak256(0xff ++ address ++ salt ++ keccak256(init_code))[12:]
The init_code
is the code that, when executed, produces the runtime
bytecode that will be placed into the state, and which typically is used
by high level languages to implement a ‘constructor’.
§Examples
let address = address!("8ba1f109551bD432803012645Ac136ddd64DBA72");
let salt = b256!("7c5ea36004851c764c44143b1dcb59679b11c9a68e5f41497f6cf3d480715331");
let init_code = bytes!("6394198df16000526103ff60206004601c335afa6040516060f3");
let expected = address!("533ae9d683B10C02EbDb05471642F85230071FC3");
assert_eq!(address.create2_from_code(salt, init_code), expected);
pub fn create2<S, H>(&self, salt: S, init_code_hash: H) -> Address
pub fn create2<S, H>(&self, salt: S, init_code_hash: H) -> Address
Computes the CREATE2
address of a smart contract as specified in
EIP-1014, taking the pre-computed hash of the init code as input:
keccak256(0xff ++ address ++ salt ++ init_code_hash)[12:]
The init_code
is the code that, when executed, produces the runtime
bytecode that will be placed into the state, and which typically is used
by high level languages to implement a ‘constructor’.
§Examples
let address = address!("5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f");
let salt = b256!("2b2f5776e38002e0c013d0d89828fdb06fee595ea2d5ed4b194e3883e823e350");
let init_code_hash = b256!("96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f");
let expected = address!("0d4a11d5EEaaC28EC3F61d100daF4d40471f1852");
assert_eq!(address.create2(salt, init_code_hash), expected);
pub fn from_raw_public_key(pubkey: &[u8]) -> Address
pub fn from_raw_public_key(pubkey: &[u8]) -> Address
pub fn from_public_key(pubkey: &VerifyingKey<Secp256k1>) -> Address
Available on crate feature k256
only.
pub fn from_public_key(pubkey: &VerifyingKey<Secp256k1>) -> Address
k256
only.Converts an ECDSA verifying key to its corresponding Ethereum address.
pub fn from_private_key(private_key: &SigningKey<Secp256k1>) -> Address
Available on crate feature k256
only.
pub fn from_private_key(private_key: &SigningKey<Secp256k1>) -> Address
k256
only.Converts an ECDSA signing key to its corresponding Ethereum address.
Methods from Deref<Target = FixedBytes<20>>§
pub const ZERO: FixedBytes<N> = _
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 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 fn const_eq(&self, other: &FixedBytes<N>) -> bool
pub fn const_eq(&self, other: &FixedBytes<N>) -> bool
Compile-time equality. NOT constant-time equality.
pub fn const_is_zero(&self) -> bool
pub fn const_is_zero(&self) -> bool
Returns true
if no bits are set.
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<'a> Arbitrary<'a> for Address
impl<'a> Arbitrary<'a> for Address
§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Address, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Address, Error>
Self
from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Address, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Address, Error>
Self
from the entirety of the given
unstructured data. Read more§impl Arbitrary for Address
impl Arbitrary for Address
§type Parameters = <FixedBytes<20> as Arbitrary>::Parameters
type Parameters = <FixedBytes<20> as Arbitrary>::Parameters
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Map<<FixedBytes<20> as Arbitrary>::Strategy, fn(_: FixedBytes<20>) -> Address>
type Strategy = Map<<FixedBytes<20> as Arbitrary>::Strategy, fn(_: FixedBytes<20>) -> Address>
Strategy
used to generate values of type Self
.§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 AsRef<FixedBytes<20>> for Address
impl AsRef<FixedBytes<20>> for Address
§fn as_ref(&self) -> &FixedBytes<20>
fn as_ref(&self) -> &FixedBytes<20>
§impl BitAndAssign for Address
impl BitAndAssign for Address
§fn bitand_assign(&mut self, rhs: Address)
fn bitand_assign(&mut self, rhs: Address)
&=
operation. Read more§impl BitOrAssign for Address
impl BitOrAssign for Address
§fn bitor_assign(&mut self, rhs: Address)
fn bitor_assign(&mut self, rhs: Address)
|=
operation. Read more§impl BitXorAssign for Address
impl BitXorAssign for Address
§fn bitxor_assign(&mut self, rhs: Address)
fn bitxor_assign(&mut self, rhs: Address)
^=
operation. Read more§impl BorrowMut<[u8]> for &mut Address
impl BorrowMut<[u8]> for &mut Address
§fn borrow_mut(&mut self) -> &mut [u8] ⓘ
fn borrow_mut(&mut self) -> &mut [u8] ⓘ
§impl BorrowMut<[u8]> for Address
impl BorrowMut<[u8]> for Address
§fn borrow_mut(&mut self) -> &mut [u8] ⓘ
fn borrow_mut(&mut self) -> &mut [u8] ⓘ
§impl BorrowMut<[u8; 20]> for &mut Address
impl BorrowMut<[u8; 20]> for &mut Address
§fn borrow_mut(&mut self) -> &mut [u8; 20]
fn borrow_mut(&mut self) -> &mut [u8; 20]
§impl BorrowMut<[u8; 20]> for Address
impl BorrowMut<[u8; 20]> for Address
§fn borrow_mut(&mut self) -> &mut [u8; 20]
fn borrow_mut(&mut self) -> &mut [u8; 20]
§impl Compact for Address
impl Compact for Address
§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) -> (Address, &[u8])
fn from_compact(buf: &[u8], len: usize) -> (Address, &[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 Address
impl Compress for Address
§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 Decode for Address
impl Decode for Address
§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
§impl Decompress for Address
impl Decompress for Address
§fn decompress(value: &[u8]) -> Result<Address, DatabaseError>
fn decompress(value: &[u8]) -> Result<Address, DatabaseError>
§fn decompress_owned(value: Vec<u8>) -> Result<Self, DatabaseError>
fn decompress_owned(value: Vec<u8>) -> Result<Self, DatabaseError>
§impl<'de> Deserialize<'de> for Address
impl<'de> Deserialize<'de> for Address
§fn deserialize<D>(
deserializer: D,
) -> Result<Address, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Address, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Distribution<Address> for Standard
impl Distribution<Address> for Standard
§impl Encode for Address
impl Encode for Address
§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 ssz_bytes_len(&self) -> usize
fn ssz_bytes_len(&self) -> usize
self
is serialized. Read more§fn ssz_append(&self, buf: &mut Vec<u8>)
fn ssz_append(&self, buf: &mut Vec<u8>)
§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<FixedBytes<20>> for Address
impl From<FixedBytes<20>> for Address
§fn from(value: FixedBytes<20>) -> Address
fn from(value: FixedBytes<20>) -> Address
§impl FromIterator<Address> for AddressFilter
impl FromIterator<Address> for AddressFilter
§fn from_iter<I>(iter: I) -> AddressFilterwhere
I: IntoIterator<Item = Address>,
fn from_iter<I>(iter: I) -> AddressFilterwhere
I: IntoIterator<Item = Address>,
§impl<__IdxT> Index<__IdxT> for Addresswhere
FixedBytes<20>: Index<__IdxT>,
impl<__IdxT> Index<__IdxT> for Addresswhere
FixedBytes<20>: Index<__IdxT>,
§impl<__IdxT> IndexMut<__IdxT> for Addresswhere
FixedBytes<20>: IndexMut<__IdxT>,
impl<__IdxT> IndexMut<__IdxT> for Addresswhere
FixedBytes<20>: IndexMut<__IdxT>,
§impl<'__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime Addresswhere
&'__deriveMoreLifetime FixedBytes<20>: IntoIterator,
impl<'__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime Addresswhere
&'__deriveMoreLifetime FixedBytes<20>: IntoIterator,
§type Item = <&'__deriveMoreLifetime FixedBytes<20> as IntoIterator>::Item
type Item = <&'__deriveMoreLifetime FixedBytes<20> as IntoIterator>::Item
§type IntoIter = <&'__deriveMoreLifetime FixedBytes<20> as IntoIterator>::IntoIter
type IntoIter = <&'__deriveMoreLifetime FixedBytes<20> as IntoIterator>::IntoIter
§impl<'__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime mut Addresswhere
&'__deriveMoreLifetime mut FixedBytes<20>: IntoIterator,
impl<'__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime mut Addresswhere
&'__deriveMoreLifetime mut FixedBytes<20>: IntoIterator,
§type Item = <&'__deriveMoreLifetime mut FixedBytes<20> as IntoIterator>::Item
type Item = <&'__deriveMoreLifetime mut FixedBytes<20> as IntoIterator>::Item
§type IntoIter = <&'__deriveMoreLifetime mut FixedBytes<20> as IntoIterator>::IntoIter
type IntoIter = <&'__deriveMoreLifetime mut FixedBytes<20> as IntoIterator>::IntoIter
§impl IntoIterator for Addresswhere
FixedBytes<20>: IntoIterator,
impl IntoIterator for Addresswhere
FixedBytes<20>: IntoIterator,
§type Item = <FixedBytes<20> as IntoIterator>::Item
type Item = <FixedBytes<20> as IntoIterator>::Item
§type IntoIter = <FixedBytes<20> as IntoIterator>::IntoIter
type IntoIter = <FixedBytes<20> as IntoIterator>::IntoIter
§impl Ord for Address
impl Ord for Address
§impl PartialOrd<&[u8]> for Address
impl PartialOrd<&[u8]> for Address
§impl PartialOrd<&Address> for [u8]
impl PartialOrd<&Address> for [u8]
§impl PartialOrd<[u8]> for &Address
impl PartialOrd<[u8]> for &Address
§impl PartialOrd<[u8]> for Address
impl PartialOrd<[u8]> for Address
§impl PartialOrd<Address> for &[u8]
impl PartialOrd<Address> for &[u8]
§impl PartialOrd<Address> for [u8]
impl PartialOrd<Address> for [u8]
§impl PartialOrd for Address
impl PartialOrd for Address
§impl Serialize for Address
impl Serialize for Address
§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 SolValue for Address
impl SolValue for Address
§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 Copy for Address
impl Eq for Address
impl MaxEncodedLen<alloy_primitives::::bits::address::{impl#94}::{constant#0}> for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
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
§impl<I> BidiIterator for I
impl<I> BidiIterator for I
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
§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> 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> 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> 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> 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: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 20 bytes