docs(abigen): update struct

This commit is contained in:
Georgios Konstantopoulos 2020-06-10 22:34:39 +03:00
parent 030fc671fe
commit f562b47fd2
No known key found for this signature in database
GPG Key ID: FA607837CD26EDBC
1 changed files with 11 additions and 0 deletions

View File

@ -28,6 +28,17 @@ use proc_macro2::TokenStream;
use std::{collections::HashMap, fs::File, io::Write, path::Path}; use std::{collections::HashMap, fs::File, io::Write, path::Path};
/// Builder struct for generating type-safe bindings from a contract's ABI /// Builder struct for generating type-safe bindings from a contract's ABI
///
/// # Example
///
/// Running the command below will generate a file called `token.rs` containing the
/// bindings inside, which exports an `ERC20Token` struct, along with all its events.
///
/// ```no_run
/// # fn foo() -> Result<(), Box<dyn std::error::Error>> {
/// Abigen::new("ERC20Token", "./abi.json")?.generate()?.write_to_file("token.rs")?;
/// # Ok(())
/// # }
pub struct Abigen { pub struct Abigen {
/// The source of the ABI JSON for the contract whose bindings /// The source of the ABI JSON for the contract whose bindings
/// are being generated. /// are being generated.