Struct ethers_contract_abigen::ContractBindings
source · pub struct ContractBindings {
pub name: String,
pub tokens: TokenStream,
pub format: bool,
}
Expand description
Type-safe contract bindings generated by Abigen.
This type can be either written to file or converted to a token stream for a procedural macro.
Fields§
§name: String
The contract’s name.
tokens: TokenStream
The generated bindings as a TokenStream
.
format: bool
Whether to format the generated bindings using prettyplease
.
Implementations§
source§impl ContractBindings
impl ContractBindings
sourcepub fn write(&self, w: &mut impl Write) -> Result<()>
pub fn write(&self, w: &mut impl Write) -> Result<()>
Writes the bindings to a given io::Write
.
sourcepub fn write_fmt(&self, w: &mut impl Write) -> Result
pub fn write_fmt(&self, w: &mut impl Write) -> Result
Writes the bindings to a given fmt::Write
.
sourcepub fn write_to_file(&self, file: impl AsRef<Path>) -> Result<()>
pub fn write_to_file(&self, file: impl AsRef<Path>) -> Result<()>
Writes the bindings to the specified file.
sourcepub fn write_module_in_dir(&self, dir: impl AsRef<Path>) -> Result<()>
pub fn write_module_in_dir(&self, dir: impl AsRef<Path>) -> Result<()>
Writes the bindings to a contract_name.rs
file in the specified directory.
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 file name of the module.
Trait Implementations§
source§impl Clone for ContractBindings
impl Clone for ContractBindings
source§fn clone(&self) -> ContractBindings
fn clone(&self) -> ContractBindings
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ContractBindings
impl Debug for ContractBindings
source§impl Display for ContractBindings
impl Display for ContractBindings
source§impl ToTokens for ContractBindings
impl ToTokens for ContractBindings
source§fn into_token_stream(self) -> TokenStream
fn into_token_stream(self) -> TokenStream
source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Auto Trait Implementations§
impl RefUnwindSafe for ContractBindings
impl !Send for ContractBindings
impl !Sync for ContractBindings
impl Unpin for ContractBindings
impl UnwindSafe for ContractBindings
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.