use crate::{ Block, FullBlock, FullBlockBody, FullBlockHeader, FullReceipt, FullSignedTx, MaybeSerdeBincodeCompat, Receipt, }; use core::fmt; /// Configures all the primitive types of the node. pub trait NodePrimitives: Send + Sync + Unpin + Clone + Default + fmt::Debug + PartialEq + Eq + 'static { /// Block primitive. type Block: Block
+ MaybeSerdeBincodeCompat; /// Block header primitive. type BlockHeader: FullBlockHeader; /// Block body primitive. type BlockBody: FullBlockBody; /// Signed version of the transaction type. type SignedTx: FullSignedTx; /// A receipt. type Receipt: Receipt; } /// Helper trait that sets trait bounds on [`NodePrimitives`]. pub trait FullNodePrimitives where Self: NodePrimitives< Block: FullBlock
, BlockHeader: FullBlockHeader, BlockBody: FullBlockBody, SignedTx: FullSignedTx, Receipt: FullReceipt, > + Send + Sync + Unpin + Clone + Default + fmt::Debug + PartialEq + Eq + 'static, { } impl FullNodePrimitives for T where T: NodePrimitives< Block: FullBlock
, BlockHeader: FullBlockHeader, BlockBody: FullBlockBody, SignedTx: FullSignedTx, Receipt: FullReceipt, > + Send + Sync + Unpin + Clone + Default + fmt::Debug + PartialEq + Eq + 'static { } /// Helper adapter type for accessing [`NodePrimitives`] block header types. pub type HeaderTy = ::BlockHeader; /// Helper adapter type for accessing [`NodePrimitives`] block body types. pub type BodyTy = ::BlockBody; /// Helper adapter type for accessing [`NodePrimitives`] block types. pub type BlockTy = ::Block; /// Helper adapter type for accessing [`NodePrimitives`] receipt types. pub type ReceiptTy = ::Receipt; /// Helper adapter type for accessing [`NodePrimitives`] signed transaction types. pub type TxTy = ::SignedTx;