pub trait QueryExecutor: Clone + Send + Sync {
    // Required method
    fn execute<'life0, 'life1, 'async_trait, OutputManaged>(
        &'life0 self,
        request: &'life1 ScCallStep
    ) -> Pin<Box<dyn Future<Output = Result<OutputManaged::Native, ExecutorError>> + Send + 'async_trait>>
       where OutputManaged: TopDecodeMulti + NativeConvertible + Send + Sync + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A trait representing the execution of smart contract queries.

This trait is implemented by types that can execute smart contract queries in a specific environment, like a real blockchain or a mocked one. The trait’s associated function, execute, is responsible for sending a query request, executing the query on the blockchain or mocked environment, and returning the result of the query.

Required Methods§

source

fn execute<'life0, 'life1, 'async_trait, OutputManaged>( &'life0 self, request: &'life1 ScCallStep ) -> Pin<Box<dyn Future<Output = Result<OutputManaged::Native, ExecutorError>> + Send + 'async_trait>>where OutputManaged: TopDecodeMulti + NativeConvertible + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executes a smart contract query and returns the result.

Parameters
  • request: A reference to the ScCallStep representing the smart contract query to be executed.
Type Parameters
  • OutputManaged: The managed type representing the expected output of the query. It must implement [TopDecodeMulti], NativeConvertible, Send, and Sync.
Returns

A Result containing the native representation of the query result, or an ExecutorError if the query execution fails.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl QueryExecutor for &str

source§

fn execute<'life0, 'life1, 'async_trait, OutputManaged>( &'life0 self, request: &'life1 ScCallStep ) -> Pin<Box<dyn Future<Output = Result<OutputManaged::Native, ExecutorError>> + Send + 'async_trait>>where OutputManaged: TopDecodeMulti + NativeConvertible + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Allows using a string representing the gateway URL to execute a query on the real blockchain environment.

This implementation creates a new ProxyQueryExecutor instance using the string as the gateway URL, and delegates the query execution to it.

source§

impl QueryExecutor for String

source§

fn execute<'life0, 'life1, 'async_trait, OutputManaged>( &'life0 self, request: &'life1 ScCallStep ) -> Pin<Box<dyn Future<Output = Result<OutputManaged::Native, ExecutorError>> + Send + 'async_trait>>where OutputManaged: TopDecodeMulti + NativeConvertible + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Allows using a string representing the gateway URL to execute a query on the real blockchain environment.

This implementation creates a new ProxyQueryExecutor instance using the string as the gateway URL, and delegates the query execution to it.

source§

impl<T: QueryExecutor> QueryExecutor for Arc<Mutex<T>>

An implementation of QueryExecutor for Arc<Mutex<T>> where T: QueryExecutor.

This implementation allows exclusive access to an executor instance, ensuring safe mutable access.

source§

fn execute<'life0, 'life1, 'async_trait, OutputManaged>( &'life0 self, request: &'life1 ScCallStep ) -> Pin<Box<dyn Future<Output = Result<OutputManaged::Native, ExecutorError>> + Send + 'async_trait>>where OutputManaged: TopDecodeMulti + NativeConvertible + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

impl<T: QueryExecutor> QueryExecutor for Arc<T>

An implementation of QueryExecutor for Arc<T> where T: QueryExecutor.

This implementation allows shared access to an executor instance.

source§

fn execute<'life0, 'life1, 'async_trait, OutputManaged>( &'life0 self, request: &'life1 ScCallStep ) -> Pin<Box<dyn Future<Output = Result<OutputManaged::Native, ExecutorError>> + Send + 'async_trait>>where OutputManaged: TopDecodeMulti + NativeConvertible + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§

source§

impl<A> QueryExecutor for MockExecutor<A>where A: Clone + Deref + Send + Sync, Address: for<'a> From<&'a A::Target>,

The MockExecutor implementation for the QueryExecutor trait, used to simulate smart contract queries in a mock environment. This struct is typically utilized in testing and development scenarios where interaction with a real blockchain is undesirable or unnecessary.

Type Parameters

  • A: A type that implements Clone, Deref, Send, and Sync traits. This type is used to derive an Address instance representing a blockchain address.
source§

impl<Proxy: BlockchainProxy> QueryExecutor for QueryNetworkExecutor<Proxy>