pub struct Abigen { /* private fields */ }
Implementations§
Source§impl Abigen
impl Abigen
Sourcepub fn new<S: AsRef<str>>(
contract_name: &str,
abi_source: S,
) -> Result<Self, Error>
pub fn new<S: AsRef<str>>( contract_name: &str, abi_source: S, ) -> Result<Self, Error>
Creates a new contract with the given ABI JSON source.
pub fn no_std(self) -> Self
Sourcepub fn generate(self) -> Result<ContractBindings, Error>
pub fn generate(self) -> Result<ContractBindings, Error>
Generates the contract bindings.
Sourcepub fn expand(&self) -> Result<TokenStream, Error>
pub fn expand(&self) -> Result<TokenStream, Error>
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 functions(&self) -> Result<TokenStream, Error>
Auto Trait Implementations§
impl Freeze for Abigen
impl RefUnwindSafe for Abigen
impl !Send for Abigen
impl !Sync for Abigen
impl Unpin for Abigen
impl UnwindSafe for Abigen
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, U> FlattenInto<U> for Twhere
U: FlattenFrom<T>,
impl<T, U> FlattenInto<U> for Twhere
U: FlattenFrom<T>,
fn flatten_into(self) -> U
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more