reth_primitives_traits/block/
mod.rs1pub mod body;
4pub mod header;
5
6use alloc::fmt;
7use alloy_rlp::{Decodable, Encodable};
8
9use crate::{BlockBody, BlockHeader, FullBlockBody, FullBlockHeader, InMemorySize, MaybeSerde};
10
11pub trait FullBlock:
13 Block<Header: FullBlockHeader, Body: FullBlockBody> + alloy_rlp::Encodable + alloy_rlp::Decodable
14{
15}
16
17impl<T> FullBlock for T where
18 T: Block<Header: FullBlockHeader, Body: FullBlockBody>
19 + alloy_rlp::Encodable
20 + alloy_rlp::Decodable
21{
22}
23
24pub type BlockTx<B> = <<B as Block>::Body as BlockBody>::Transaction;
26
27pub trait Block:
32 Send
33 + Sync
34 + Unpin
35 + Clone
36 + Default
37 + fmt::Debug
38 + PartialEq
39 + Eq
40 + InMemorySize
41 + MaybeSerde
42 + Encodable
43 + Decodable
44{
45 type Header: BlockHeader;
47
48 type Body: BlockBody<OmmerHeader = Self::Header>;
50
51 fn new(header: Self::Header, body: Self::Body) -> Self;
53
54 fn header(&self) -> &Self::Header;
56
57 fn body(&self) -> &Self::Body;
59
60 fn split(self) -> (Self::Header, Self::Body);
62}