pub struct ABIDecoder;

Implementations

Decodes types described by param_types into their respective Tokens using the data in bytes and receipts.

Arguments
  • param_types: The ParamType’s of the types we expect are encoded inside bytes and receipts.
  • bytes: The bytes to be used in the decoding process.
Examples
use fuels_core::abi_decoder::ABIDecoder;
use fuels_core::Token;
use fuels_types::param_types::ParamType;

let tokens = ABIDecoder::decode(&[ParamType::U8, ParamType::U8], &[0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2]).unwrap();

assert_eq!(tokens, vec![Token::U8(1), Token::U8(2)])

The same as decode just for a single type. Used in most cases since contract functions can only return one type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.