pub struct Context { /* private fields */ }
Expand description

Internal shared context for generating smart contract bindings.

Implementations§

source§

impl Context

source

pub fn events_declaration(&self) -> Result<TokenStream>

Expands each event to a struct + its impl Detokenize block

source

pub fn event_methods(&self) -> Result<TokenStream>

Generate the event filter methods for the contract

source§

impl Context

Expands a context into a method struct containing all the generated bindings to the Solidity contract methods.

source

pub fn expand_return_struct( &self, function: &Function, alias: Option<&MethodAlias> ) -> Result<Option<TokenStream>>

Expands to the corresponding struct type based on the inputs of the given function

source§

impl Context

source

pub fn abi_structs(&self) -> Result<TokenStream>

Generate corresponding types for structs parsed from a human readable ABI

NOTE: This assumes that all structs that are potentially used as type for variable are in fact present in the AbiParser, this is sound because AbiParser::parse would have failed already

source

pub fn remove_struct(&mut self, name: &str)

In the event of type conflicts this allows for removing a specific struct type.

source

pub fn struct_definition(&mut self, name: &str) -> Result<TokenStream>

Returns the type definition for the struct with the given name

source§

impl Context

source

pub fn expand(&self) -> Result<ExpandedContract>

Generates the tokens.

source

pub fn from_abigen(args: Abigen) -> Result<Self>

Create a context from the code generation arguments.

source

pub fn internal_structs(&self) -> &InternalStructs

Returns a reference to the internal ABI struct mapping table.

source

pub fn internal_structs_mut(&mut self) -> &mut InternalStructs

Returns a mutable reference to the internal ABI struct mapping table.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> JsonSchemaMaybe for T