Trait TxEnvConverter
pub trait TxEnvConverter<TxReq, TxEnv, Spec>:
Debug
+ Send
+ Sync
+ Unpin
+ Clone
+ 'static {
type Error;
// Required method
fn convert_tx_env(
&self,
tx_req: TxReq,
cfg_env: &CfgEnv<Spec>,
block_env: &BlockEnv,
) -> Result<TxEnv, Self::Error>;
}
Expand description
Converts TxReq
into TxEnv
.
Where:
TxReq
is a transaction request received from an RPC APITxEnv
is the corresponding transaction environment for execution
The TxEnvConverter
has two blanket implementations:
()
assumingTxReq
implementsTryIntoTxEnv
and is used as default forRpcConverter
.Fn(TxReq, &CfgEnv<Spec>, &BlockEnv) -> Result<TxEnv, E>
and can be applied usingRpcConverter::with_tx_env_converter
.
One should prefer to implement TryIntoTxEnv
for TxReq
to get the TxEnvConverter
implementation for free, thanks to the blanket implementation, unless the conversion requires
more context. For example, some configuration parameters or access handles to database, network,
etc.
Required Associated Types§
type Error
type Error
An associated error that can occur during conversion.
Required Methods§
fn convert_tx_env(
&self,
tx_req: TxReq,
cfg_env: &CfgEnv<Spec>,
block_env: &BlockEnv,
) -> Result<TxEnv, Self::Error>
fn convert_tx_env( &self, tx_req: TxReq, cfg_env: &CfgEnv<Spec>, block_env: &BlockEnv, ) -> Result<TxEnv, Self::Error>
Converts a rpc transaction request into a transaction environment.
See TxEnvConverter
for more information.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
§impl<TxReq, TxEnv, Spec> TxEnvConverter<TxReq, TxEnv, Spec> for ()where
TxReq: TryIntoTxEnv<TxEnv>,
impl<TxReq, TxEnv, Spec> TxEnvConverter<TxReq, TxEnv, Spec> for ()where
TxReq: TryIntoTxEnv<TxEnv>,
type Error = <TxReq as TryIntoTxEnv<TxEnv>>::Err
fn convert_tx_env( &self, tx_req: TxReq, cfg_env: &CfgEnv<Spec>, block_env: &BlockEnv, ) -> Result<TxEnv, <() as TxEnvConverter<TxReq, TxEnv, Spec>>::Error>
Implementors§
§impl<F, TxReq, TxEnv, E, Spec> TxEnvConverter<TxReq, TxEnv, Spec> for F
Converts rpc transaction requests into transaction environment using a closure.
impl<F, TxReq, TxEnv, E, Spec> TxEnvConverter<TxReq, TxEnv, Spec> for F
Converts rpc transaction requests into transaction environment using a closure.