Trait SimTxConverter
pub trait SimTxConverter<TxReq, SimTx>:
Clone
+ Debug
+ Unpin
+ Send
+ Sync
+ 'static {
type Err: Error;
// Required method
fn convert_sim_tx(&self, tx_req: TxReq) -> Result<SimTx, Self::Err>;
}
Expand description
Converts TxReq
into SimTx
.
Where:
TxReq
is a transaction request received from an RPC APISimTx
is the corresponding consensus layer transaction for execution simulation
The SimTxConverter
has two blanket implementations:
()
assumingTxReq
implementsTryIntoSimTx
and is used as default forRpcConverter
.Fn(TxReq) -> Result<SimTx, ValueError<TxReq>>
and can be applied usingRpcConverter::with_sim_tx_converter
.
One should prefer to implement TryIntoSimTx
for TxReq
to get the SimTxConverter
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§
Required Methods§
fn convert_sim_tx(&self, tx_req: TxReq) -> Result<SimTx, Self::Err>
fn convert_sim_tx(&self, tx_req: TxReq) -> Result<SimTx, Self::Err>
Performs the conversion from tx_req
into SimTx
.
See SimTxConverter
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.