Trait FromConsensusTx
pub trait FromConsensusTx<T> {
type TxInfo;
// Required method
fn from_consensus_tx(tx: T, signer: Address, tx_info: Self::TxInfo) -> Self;
}
node-api
only.Expand description
Converts T
into self
. It is reciprocal of IntoRpcTx
.
Should create an RPC transaction response object based on a consensus transaction, its signer
Address
and an additional context FromConsensusTx::TxInfo
.
Prefer implementing FromConsensusTx
over IntoRpcTx
because it automatically provides an
implementation of IntoRpcTx
thanks to the blanket implementation in this crate.
Prefer using IntoRpcTx
over using FromConsensusTx
when specifying trait bounds on a
generic function. This way, types that directly implement IntoRpcTx
can be used as arguments
as well.
Required Associated Types§
type TxInfo
type TxInfo
An additional context, usually TransactionInfo
in a wrapper that carries some
implementation specific extra information.
Required Methods§
fn from_consensus_tx(tx: T, signer: Address, tx_info: Self::TxInfo) -> Self
fn from_consensus_tx(tx: T, signer: Address, tx_info: Self::TxInfo) -> Self
Performs the conversion consuming tx
with signer
and tx_info
. See FromConsensusTx
for details.
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.