Struct ethcontract::contract::ViewMethodBuilder

source ·
pub struct ViewMethodBuilder<T: Transport, R: Tokenize> {
    pub m: MethodBuilder<T, R>,
    pub block: Option<BlockId>,
}
Expand description

Data used for building a contract method call. The view method builder can’t directly send transactions and is for read only method calls.

Fields§

§m: MethodBuilder<T, R>

method parameters

§block: Option<BlockId>

optional block number

Implementations§

source§

impl<T: Transport, R: Tokenize> ViewMethodBuilder<T, R>

source

pub fn from_method(method: MethodBuilder<T, R>) -> Self

Create a new ViewMethodBuilder by demoting a MethodBuilder.

source

pub fn with_defaults(self, defaults: &MethodDefaults) -> Self

Apply method defaults to this builder.

source

pub fn function(&self) -> &Function

Returns a reference to the underling ABI function for this call.

source

pub fn from(self, value: Address) -> Self

Specify the account the transaction is being sent from.

source

pub fn gas(self, value: U256) -> Self

Secify amount of gas to use, if not specified then a gas estimate will be used.

source

pub fn gas_price(self, value: GasPrice) -> Self

Specify the gas price to use, if not specified then the estimated gas price will be used.

source

pub fn value(self, value: U256) -> Self

Specify what how much ETH to transfer with the transaction, if not specified then no ETH will be sent.

source

pub fn nonce(self, value: U256) -> Self

Specify the nonce for the transation, if not specified will use the current transaction count for the signing account.

source

pub fn access_list(self, value: AccessList) -> Self

Specify the access list for the transaction, if not specified no access list will be used.

source

pub fn block(self, value: BlockId) -> Self

Specify the block height for the call, if not specified then latest mined block will be used.

source§

impl<T: Transport, R: Tokenize> ViewMethodBuilder<T, R>

source

pub async fn call(self) -> Result<R, MethodError>

Call a contract method. Contract calls do not modify the blockchain and as such do not require gas or signing.

source

pub fn batch_call<B: BatchTransport>( self, batch: &mut CallBatch<B> ) -> impl Future<Output = Result<R, MethodError>>

Adds this view method to a batch. Allows execution with other contract calls in one roundtrip The returned future only resolve once batch is resolved. Panics, if batch is dropped before executing

Trait Implementations§

source§

impl<T: Clone + Transport, R: Clone + Tokenize> Clone for ViewMethodBuilder<T, R>

source§

fn clone(&self) -> ViewMethodBuilder<T, R>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + Transport, R: Debug + Tokenize> Debug for ViewMethodBuilder<T, R>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, R> Freeze for ViewMethodBuilder<T, R>
where T: Freeze,

§

impl<T, R> RefUnwindSafe for ViewMethodBuilder<T, R>

§

impl<T, R> Send for ViewMethodBuilder<T, R>
where T: Send, R: Send,

§

impl<T, R> Sync for ViewMethodBuilder<T, R>
where T: Sync, R: Sync,

§

impl<T, R> Unpin for ViewMethodBuilder<T, R>
where T: Unpin, R: Unpin,

§

impl<T, R> UnwindSafe for ViewMethodBuilder<T, R>
where T: UnwindSafe, R: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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