Trait pint::client::ExecuteWithClient [−][src]
pub trait ExecuteWithClient {
type Output;
fn execute_with_client<Client, Api, Backend>(
self,
client: Arc<Client>
) -> Self::Output
where
<Api as ApiExt<Block>>::StateBackend: StateBackend<BlakeTwo256>,
Backend: Backend<Block>,
Backend::State: StateBackend<BlakeTwo256>,
Api: RuntimeApiCollection<StateBackend = Backend::State>,
Client: AbstractClient<Block, Backend, Api = Api> + 'static;
}
Expand description
Execute something with the client instance.
As there exist multiple chains inside Polkadot, like Polkadot itself,
Kusama, Dev etc, there can exist different kinds of client types. As these
client types differ in the generics that are being used, we can not easily
return them from a function. For returning them from a function there exists
Client
. However, the problem on how to use this client instance still
exists. This trait “solves” it in a dirty way. It requires a type to
implement this trait and than the [execute_with_client
](ExecuteWithClient:
:execute_with_client) function can be called with any possible client
instance.
In a perfect world, we could make a closure work in this way.
Associated Types
Required methods
fn execute_with_client<Client, Api, Backend>(
self,
client: Arc<Client>
) -> Self::Output where
<Api as ApiExt<Block>>::StateBackend: StateBackend<BlakeTwo256>,
Backend: Backend<Block>,
Backend::State: StateBackend<BlakeTwo256>,
Api: RuntimeApiCollection<StateBackend = Backend::State>,
Client: AbstractClient<Block, Backend, Api = Api> + 'static,
fn execute_with_client<Client, Api, Backend>(
self,
client: Arc<Client>
) -> Self::Output where
<Api as ApiExt<Block>>::StateBackend: StateBackend<BlakeTwo256>,
Backend: Backend<Block>,
Backend::State: StateBackend<BlakeTwo256>,
Api: RuntimeApiCollection<StateBackend = Backend::State>,
Client: AbstractClient<Block, Backend, Api = Api> + 'static,
Execute whatever should be executed with the given client instance.