Struct ethers_contract_abigen::ContractBindings
source · pub struct ContractBindings { /* private fields */ }
Expand description
Type-safe contract bindings generated by a Builder
. This type can be
either written to file or into a token stream for use in a procedural macro.
Implementations§
source§impl ContractBindings
impl ContractBindings
sourcepub fn write<W>(&self, w: W) -> Result<()>where
W: Write,
pub fn write<W>(&self, w: W) -> Result<()>where
W: Write,
Writes the bindings to a given Write
.
sourcepub fn to_vec(&self) -> Vec<u8> ⓘ
pub fn to_vec(&self) -> Vec<u8> ⓘ
Writes the bindings to a new Vec. Panics if unable to allocate
sourcepub fn write_to_file<P>(&self, path: P) -> Result<()>where
P: AsRef<Path>,
pub fn write_to_file<P>(&self, path: P) -> Result<()>where
P: AsRef<Path>,
Writes the bindings to the specified file.
sourcepub fn write_module_in_dir<P>(&self, dir: P) -> Result<()>where
P: AsRef<Path>,
pub fn write_module_in_dir<P>(&self, dir: P) -> Result<()>where
P: AsRef<Path>,
Writes the bindings to a contract_name.rs
file in the specified
directory. The filename is the snake_case transformation of the contract
name.
sourcepub fn into_tokens(self) -> TokenStream
pub fn into_tokens(self) -> TokenStream
Converts the bindings into its underlying token stream. This allows it to be used within a procedural macro.
sourcepub fn module_name(&self) -> String
pub fn module_name(&self) -> String
Generate the default module name (snake case of the contract name)
sourcepub fn module_filename(&self) -> String
pub fn module_filename(&self) -> String
Generate the default filename of the module