Trait novax_executor::QueryExecutor
source · 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§
sourcefn 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,
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 theScCallSteprepresenting 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, andSync.
Returns
A Result containing the native representation of the query result,
or an ExecutorError if the query execution fails.
Object Safety§
Implementations on Foreign Types§
source§impl QueryExecutor for &str
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,
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
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,
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>>
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.
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>
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.
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§
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 implementsClone,Deref,Send, andSynctraits. This type is used to derive anAddressinstance representing a blockchain address.