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 Freeze for ContractBindings
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.