pub struct Function {
pub name: String,
pub inputs: Vec<Param>,
pub outputs: Vec<Param>,
}Expand description
A function as Solidity or viem writes it: transfer(address to, uint256 amount) returns (bool), with or without function and its modifiers.
Fields§
§name: String§inputs: Vec<Param>§outputs: Vec<Param>Implementations§
Source§impl Function
impl Function
pub fn parse(text: &str) -> Result<Function, AbiError>
Sourcepub fn selector(&self) -> [u8; 4]
pub fn selector(&self) -> [u8; 4]
The four bytes that name the function: the start of keccak256(signature).
Sourcepub fn encode(&self, args: &[Token]) -> Result<Vec<u8>, AbiError>
pub fn encode(&self, args: &[Token]) -> Result<Vec<u8>, AbiError>
The calldata of a call: the selector, then the arguments.
Trait Implementations§
impl Eq for Function
impl StructuralPartialEq for Function
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnsafeUnpin for Function
impl UnwindSafe for Function
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.