reth_node_core::primitives

Trait Block

pub trait Block:
    Send
    + Sync
    + Unpin
    + Clone
    + Default
    + Debug
    + PartialEq
    + Eq
    + InMemorySize
    + MaybeSerde
    + Encodable
    + Decodable {
    type Header: BlockHeader;
    type Body: BlockBody<OmmerHeader = Self::Header>;

    // Required methods
    fn new(header: Self::Header, body: Self::Body) -> Self;
    fn header(&self) -> &Self::Header;
    fn body(&self) -> &Self::Body;
    fn split(self) -> (Self::Header, Self::Body);
}
Expand description

Abstraction of block data type.

Required Associated Types§

type Header: BlockHeader

Header part of the block.

type Body: BlockBody<OmmerHeader = Self::Header>

The block’s body contains the transactions in the block.

Required Methods§

fn new(header: Self::Header, body: Self::Body) -> Self

Create new block instance.

fn header(&self) -> &Self::Header

Returns reference to block header.

fn body(&self) -> &Self::Body

Returns reference to block body.

fn split(self) -> (Self::Header, Self::Body)

Splits the block into its header and body.

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<T> Block for Block<T>

§

type Header = Header

§

type Body = BlockBody<T>

§

fn new( header: <Block<T> as Block>::Header, body: <Block<T> as Block>::Body, ) -> Block<T>

§

fn header(&self) -> &<Block<T> as Block>::Header

§

fn body(&self) -> &<Block<T> as Block>::Body

§

fn split(self) -> (<Block<T> as Block>::Header, <Block<T> as Block>::Body)

§

impl<T> Block for Block<T>

§

type Header = Header

§

type Body = BlockBody<T>

§

fn new( header: <Block<T> as Block>::Header, body: <Block<T> as Block>::Body, ) -> Block<T>

§

fn header(&self) -> &<Block<T> as Block>::Header

§

fn body(&self) -> &<Block<T> as Block>::Body

§

fn split(self) -> (<Block<T> as Block>::Header, <Block<T> as Block>::Body)

Implementors§