Struct fuels_core::abi_decoder::ABIDecoder
source · pub struct ABIDecoder;Implementations
sourceimpl ABIDecoder
impl ABIDecoder
sourcepub fn decode(
param_types: &[ParamType],
bytes: &[u8]
) -> Result<Vec<Token>, CodecError>
pub fn decode(
param_types: &[ParamType],
bytes: &[u8]
) -> Result<Vec<Token>, CodecError>
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 insidebytesandreceipts.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)])sourcepub fn decode_single(
param_type: &ParamType,
bytes: &[u8]
) -> Result<Token, CodecError>
pub fn decode_single(
param_type: &ParamType,
bytes: &[u8]
) -> Result<Token, CodecError>
The same as decode just for a single type. Used in most cases since
contract functions can only return one type.
Auto Trait Implementations
impl RefUnwindSafe for ABIDecoder
impl Send for ABIDecoder
impl Sync for ABIDecoder
impl Unpin for ABIDecoder
impl UnwindSafe for ABIDecoder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more