SimTxConverter

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 API
  • SimTx is the corresponding consensus layer transaction for execution simulation

The SimTxConverter has two blanket implementations:

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§

type Err: Error

An associated error that can occur during the conversion.

Required Methods§

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.

Implementations on Foreign Types§

§

impl<TxReq, SimTx> SimTxConverter<TxReq, SimTx> for ()
where TxReq: TryIntoSimTx<SimTx> + Debug,

§

type Err = ValueError<TxReq>

§

fn convert_sim_tx( &self, tx_req: TxReq, ) -> Result<SimTx, <() as SimTxConverter<TxReq, SimTx>>::Err>

Implementors§

§

impl<TxReq, SimTx, F, E> SimTxConverter<TxReq, SimTx> for F
where TxReq: Debug, E: Error, F: Fn(TxReq) -> Result<SimTx, E> + Clone + Debug + Unpin + Send + Sync + 'static,

§

type Err = E