Struct std::vm::evm::evm_address::EvmAddress
pub struct EvmAddress {
/// The underlying evm address data.
bits: b256,
}
Expand description
The EvmAddress
type, a struct wrapper around the inner b256
value.
Fields
bits: b256
The underlying evm address data.
Implementations
fn bits(self) -> b256
fn bits(self) -> b256
Returns the underlying bits for the EvmAddress type.
Returns
- [b256] - The
b256
that make up the EvmAddress.
Examples
use std::evm::EvmAddress;
fn foo() {
let evm_address = EvmAddress::zero();
assert(evm_address.bits() == b256::zero());
}
fn zero() -> Self
fn zero() -> Self
Returns the zero value for the EvmAddress
type.
Returns
- [EvmAddress] -> The zero value for the
EvmAddress
type.
Examples
use std::evm::EvmAddress;
fn foo() {
let zero_evm_address = EvmAddress::zero();
assert(zero_evm_address == EvmAddress::from(b256::zero()));
}
fn is_zero(self) -> bool
fn is_zero(self) -> bool
Returns whether an EvmAddress
is set to zero.
Returns
- [bool] -> True if the
EvmAddress
is zero, otherwise false.
Examples
use std::evm::EvmAddress;
fn foo() {
let zero_evm_address = EvmAddress::zero();
assert(zero_evm_address.is_zero());
}
Trait Implementations
impl AbiEncode for EvmAddress
impl AbiEncode for EvmAddress
fn abi_encode(self, buffer: Buffer) -> Buffer
impl AbiDecode for EvmAddress
impl AbiDecode for EvmAddress
fn abi_decode(refmut buffer: BufferReader) -> Self
impl Eq for EvmAddress
impl Eq for EvmAddress
fn eq(self, other: Self) -> bool
fn neq(self, other: Self) -> bool
fn neq(self, other: Self) -> bool
Evaluates if two values of the same type are not equal.
Additional Information
This function is inherited when eq()
is implemented.
Arguments
other
: [Self] - The value of the same type.
Returns
- [bool] -
true
if the two values are not equal, otherwisefalse
.
Examples
struct MyStruct {
val: u64,
}
impl Eq for MyStruct {
fn eq(self, other: Self) -> bool {
self.val == other.val
}
}
fn foo() {
let struct1 = MyStruct { val: 10 };
let struct2 = MyStruct { val: 2 };
let result = struct1 != struct2;
assert(result);
}
impl From<b256> for EvmAddress
impl From<b256> for EvmAddress
fn from(bits: b256) -> Self
fn from(bits: b256) -> Self
Casts raw b256
data to an EvmAddress
.
Arguments
bits
: [b256] - The rawb256
data to be casted.
Returns
- [EvmAddress] - The newly created
EvmAddress
from the rawb256
.
Examples
use std::evm::EvmAddress;
fn foo() {
let evm_address = EvmAddress::from(b256::zero());
}