pub fn expand(&self) -> Result<TokenStream, Error> {
        let name = &self.contract_name;
        let name_mod = ident(&format!(
            "{}_mod",
            self.contract_name.to_string().to_lowercase()
        ));

        let contract_functions = self.functions()?;
        let abi_structs = self.abi_structs()?;
        let abi_enums = self.abi_enums()?;

        let (includes, code) = if self.no_std {
            (
                quote! {
                    use alloc::{vec, vec::Vec};
                },
                quote! {},
            )
        } else {
            (
                quote! {
                    use fuels_contract::contract::{Contract, ContractCall, CompiledContract};
                    use fuel_gql_client::client::FuelClient;
                },
                quote! {
                    pub struct #name {
                        compiled: CompiledContract,
                        fuel_client: FuelClient
                    }

                    impl #name {
                        pub fn new(compiled: CompiledContract, fuel_client: FuelClient) -> Self {
                            Self{ compiled, fuel_client }
                        }

                        #contract_functions
                    }
                },
            )
        };

        Ok(quote! {
            pub use #name_mod::*;

            #[allow(clippy::too_many_arguments)]
            mod #name_mod {
                #![allow(clippy::enum_variant_names)]
                #![allow(dead_code)]
                #![allow(unused_imports)]

                #includes
                use fuels_core::{EnumSelector, ParamType, Tokenizable, Token};

                #code

                #abi_structs
                #abi_enums
            }
        })
    }
/// Entry point of the Abigen's expansion logic.
/// The high-level goal of this function is to expand* a contract
/// defined as a JSON 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).
Entry point of the Abigen's expansion logic.
The high-level goal of this function is to expand* a contract
defined as a JSON 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).
Entry point of the Abigen ' s expansion logic . The high - level goal of this function is to expand * a contract defined as a JSON 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 ) .
pub fn expand(&self) -> Result<TokenStream, Error> {
        let name = &self.contract_name;
        let name_mod = ident(&format!(
            "{}_mod",
            self.contract_name.to_string().to_lowercase()
        ));
        let contract_functions = self.functions()?;
        let abi_structs = self.abi_structs()?;
        let abi_enums = self.abi_enums()?;
        let (includes, code) = if self.no_std {
            (
                quote! {
                    use alloc::{vec, vec::Vec};
                },
                quote! {},
            )
        } else {
            (
                quote! {
                    use fuels_contract::contract::{Contract, ContractCall, CompiledContract};
                    use fuel_gql_client::client::FuelClient;
                },
                quote! {
                    pub struct #name {
                        compiled: CompiledContract,
                        fuel_client: FuelClient
                    }
                    impl #name {
                        pub fn new(compiled: CompiledContract, fuel_client: FuelClient) -> Self {
                            Self{ compiled, fuel_client }
                        }
                        #contract_functions
                    }
                },
            )
        };
        Ok(quote! {
            pub use #name_mod::*;
            #[allow(clippy::too_many_arguments)]
            mod #name_mod {
                #![allow(clippy::enum_variant_names)]
                #![allow(dead_code)]
                #![allow(unused_imports)]
                #includes
                use fuels_core::{EnumSelector, ParamType, Tokenizable, Token};
                #code
                #abi_structs
                #abi_enums
            }
        })
    }
pub fn expand ( & self ) -> Result < TokenStream , Error > { let name = & self . contract_name ; let name_mod = ident ( & format ! ( " " self contract_name to_string ( ) to_lowercase ( ) ) ) ; let contract_functions = self . functions ( ) ? ; let abi_structs = self . abi_structs ( ) ? ; let abi_enums = self . abi_enums ( ) ? ; let ( includes , code ) = if self . no_std { ( quote ! { use alloc { vec vec Vec } } , quote ! { } , ) } else { ( quote ! { use fuels_contract contract { Contract ContractCall CompiledContract } use fuel_gql_client client FuelClient } , quote ! { pub struct name { compiled CompiledContract fuel_client FuelClient } impl name { pub fn new ( compiled CompiledContract fuel_client FuelClient ) Self { Self { compiled fuel_client } } contract_functions } } , ) } ; Ok ( quote ! { pub use name_mod [ allow ( clippy too_many_arguments ) ] mod name_mod { [ allow ( clippy enum_variant_names ) ] [ allow ( dead_code ) ] [ allow ( unused_imports ) ] includes use fuels_core { EnumSelector ParamType Tokenizable Token } code abi_structs abi_enums } } ) }
Entry point of the Abigen's expansion logic.
Entry point of the Abigen ' s expansion logic .
&self