Struct fuels_core::code_gen::abigen::Abigen
source · pub struct Abigen { /* private fields */ }
Implementations§
source§impl Abigen
impl Abigen
sourcepub fn new<S: AsRef<str>>(
contract_name: &str,
abi_source: S
) -> Result<Self, Error>
pub fn new<S: AsRef<str>>(
contract_name: &str,
abi_source: S
) -> Result<Self, Error>
Creates a new contract with the given ABI JSON source.
pub fn no_std(self) -> Self
sourcepub fn generate(self) -> Result<ContractBindings, Error>
pub fn generate(self) -> Result<ContractBindings, Error>
Generates the contract bindings.
sourcepub fn expand_contract(&self) -> Result<TokenStream, Error>
pub fn expand_contract(&self) -> Result<TokenStream, Error>
Entry point of the Abigen’s expansion logic. The high-level goal of this function is to expand* a contract defined as a JSON ABI into type-safe bindings of that contract that can be used after it is brought into scope after a successful generation.
*: To expand, in procedural macro terms, means to automatically generate Rust code after a
transformation of TokenStream
to another set of TokenStream
. This generated Rust code is
the brought into scope after it is called through a procedural macro
(abigen!()
in our case).
sourcepub fn expand_script(&self) -> Result<TokenStream, Error>
pub fn expand_script(&self) -> Result<TokenStream, Error>
Expand a script into type-safe Rust bindings based on its ABI. See expand_contract
for
more details.
pub fn contract_functions(&self) -> Result<TokenStream, Error>
pub fn script_function(&self) -> Result<TokenStream, Error>
pub fn should_skip_codegen(type_field: &str) -> Result<bool>
sourcepub fn get_types(abi: &ProgramABI) -> HashMap<usize, TypeDeclaration>
pub fn get_types(abi: &ProgramABI) -> HashMap<usize, TypeDeclaration>
Reads the parsed ABI and returns all the types in it.