pub enum SolidityDataType<'a> {
String(&'a str),
Address(Address),
Bytes(&'a [u8]),
Bool(bool),
Number(U256),
NumberWithShift(U256, TakeLastXBytes),
}Expand description
Represents a data type in solidity
use eth_encode_packed::SolidityDataType;
use eth_encode_packed::TakeLastXBytes;
use eth_encode_packed::ethabi::ethereum_types::{U256, Address};
// Uint24
SolidityDataType::NumberWithShift(U256::from(3838), TakeLastXBytes(24));
// String
SolidityDataType::String("ipfs-cid-url-very-long");
// Bool
SolidityDataType::Bool(true);
// Address
use std::convert::TryInto;
let address = hex::decode("d8b934580fcE35a11B58C6D73aDeE468a2833fa8").unwrap();
let address: [u8; 20] = address.try_into().unwrap();
SolidityDataType::Address(Address::from(address));Variants§
String(&'a str)
Address(Address)
Bytes(&'a [u8])
Bool(bool)
Number(U256)
NumberWithShift(U256, TakeLastXBytes)
Auto Trait Implementations§
impl<'a> Freeze for SolidityDataType<'a>
impl<'a> RefUnwindSafe for SolidityDataType<'a>
impl<'a> Send for SolidityDataType<'a>
impl<'a> Sync for SolidityDataType<'a>
impl<'a> Unpin for SolidityDataType<'a>
impl<'a> UnwindSafe for SolidityDataType<'a>
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