Trait basilisk::client::ExecuteWithClient
source · 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> + 'static,
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 Basilisk, like Basilisk itself and testing runtime,
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
function can be called
with any possible client instance.
In a perfect world, we could make a closure work in this way.
Required Associated Types§
Required Methods§
sourcefn execute_with_client<Client, Api, Backend>(
self,
client: Arc<Client>
) -> Self::Outputwhere
<Api as ApiExt<Block>>::StateBackend: StateBackend<BlakeTwo256>,
Backend: Backend<Block> + 'static,
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::Outputwhere
<Api as ApiExt<Block>>::StateBackend: StateBackend<BlakeTwo256>,
Backend: Backend<Block> + 'static,
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.