fuels
makes use of the ABIEncoder
and the ABIDecoder
. Token
. This is commonly done by implementing the Tokenizable
trait. ParamType
describing the schema of the type in question. This is commonly done by implementing the Parameterize trait. fuels
also contains implementations for: Tokenizable
for the fuels
-owned types listed here as well as for some foreign types (such as u8
, u16
, std::vec::Vec<T: Tokenizable>
, etc.). Parameterize
for the fuels
-owned types listed here as well as for some foreign types (such as u8
, u16
, std::vec::Vec<T: Parameterize>
, etc.). Tokenizable
and Parameterize
can be derived for struct
s and enum
s if all inner types implement the derived traits: use fuels::macros::{Parameterize, Tokenizable};
#[derive(Parameterize, Tokenizable)]
struct MyStruct {
field_a: u8,
}
#[derive(Parameterize, Tokenizable)]
enum SomeEnum {
A(MyStruct),
B(Vec<u64>),
}
fuels
package is accessible through ::fuels
. If this is not the case then the derivation macro needs to be given the locations of fuels::types
and fuels::core
. #[derive(Parameterize, Tokenizable)]
#[FuelsCorePath = "fuels_core_elsewhere"]
#[FuelsTypesPath = "fuels_types_elsewhere"]
pub struct SomeStruct {
field_a: u64,
}
no-std
generated code: use fuels::macros::{Parameterize, Tokenizable};
#[derive(Parameterize, Tokenizable)]
#[NoStd]
pub struct SomeStruct {
field_a: u64,
}