pub enum Token {
Uint(U256),
Int(U256),
Address(Address),
Bool(bool),
String(String),
Bytes(Vec<u8>),
Fixed(Vec<u8>),
Array(Vec<Token>),
Tuple(Vec<Token>),
}Expand description
A value of some Kind.
Variants§
Uint(U256)
Int(U256)
Two’s complement in 256 bits: -1 is all ones, whatever the width.
Address(Address)
Bool(bool)
String(String)
Bytes(Vec<u8>)
Fixed(Vec<u8>)
The n bytes of a bytesN.
Array(Vec<Token>)
T[] and T[n].
Tuple(Vec<Token>)
Implementations§
Source§impl Token
impl Token
pub fn uint(value: impl Into<U256>) -> Token
pub fn int(value: i128) -> Token
pub fn address(address: Address) -> Token
Sourcepub fn parse(kind: &Kind, name: &str, text: &str) -> Result<Token, AbiError>
pub fn parse(kind: &Kind, name: &str, text: &str) -> Result<Token, AbiError>
A typed value read into this kind: decimal for integers, 0x hex for
addresses and bytes, true or false, and [a, b] or (a, b) for
the containers. name is what a refusal calls the field.
Sourcepub fn show(&self, kind: &Kind) -> String
pub fn show(&self, kind: &Kind) -> String
The value as a person reads it: decimal integers, 0x hex, and the
containers in brackets, a tuple’s fields named where kind names them.
pub fn as_u256(&self) -> Option<U256>
pub fn as_u128(&self) -> Option<u128>
pub fn as_u64(&self) -> Option<u64>
pub fn as_u32(&self) -> Option<u32>
pub fn as_u16(&self) -> Option<u16>
pub fn as_u8(&self) -> Option<u8>
pub fn as_i64(&self) -> Option<i64>
pub fn as_i8(&self) -> Option<i8>
pub fn as_address(&self) -> Option<Address>
pub fn as_bool(&self) -> Option<bool>
pub fn as_str(&self) -> Option<&str>
Trait Implementations§
impl Eq for Token
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnsafeUnpin for Token
impl UnwindSafe for Token
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key and return true if they are equal.