pub struct Address(/* private fields */);
Expand description
Representation of an Ethereum address.
Address is usually derived from a PrivateKey
, or converted from its
textual representation.
Implementations§
source§impl Address
impl Address
sourcepub fn from_slice(data: &[u8]) -> Result<Address, Error>
pub fn from_slice(data: &[u8]) -> Result<Address, Error>
Creates an Address from a slice.
This requires a slice to be exactly 20 bytes in length,
sourcepub fn from_rlp_data(data: RlpToken) -> Result<Address, Error>
pub fn from_rlp_data(data: RlpToken) -> Result<Address, Error>
Attempts to decode an address from RLP data, with special case handling for the zero address case
pub fn parse_and_validate(input: &str) -> Result<Address, Error>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Address
impl<'de> Deserialize<'de> for Address
source§fn deserialize<D>(deserializer: D) -> Result<Address, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Address, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl FromStr for Address
impl FromStr for Address
source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a string into a valid Ethereum address.
§Supported formats
0x
prefixed address- Raw bytes of an address represented by a bytes as an hexadecimal.
§Examples
use clarity::Address;
// Method 1
Address::from_str("0x0102030405060708090a0b0c0d0e0f1011121314").unwrap();
// Method 1 (without 0x prefix)
Address::from_str("0102030405060708090a0b0c0d0e0f1011121314").unwrap();
// Method 2
let _address : Address = "14131211100f0e0d0c0b0a090807060504030201".parse().unwrap();
source§impl Ord for Address
impl Ord for Address
source§impl PartialEq for Address
impl PartialEq for Address
source§impl PartialOrd for Address
impl PartialOrd for Address
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Address
impl Eq 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§
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
Mutably borrows from an owned value. Read more