Skip to main content

GenericBlock

Trait GenericBlock 

Source
pub trait GenericBlock<'a>
where Self: Clone + Debug + Send + Sync,
{ type Header: GenericBlockHeader<'a>; type Body: GenericBlockBody<'a>; type Owned: GenericOwnedBlock<Block<'a> = Self> where Self: 'a; const SHARD_KIND: RealShardKind; // Required methods fn header(&self) -> &Self::Header; fn body(&self) -> &Self::Body; fn to_owned(self) -> Self::Owned; }
ⓘ This trait cannot be implemented outside ab_core_primitives.
Expand description

Generic block.

Can’t be implemented outside of this module, so that code generic over blocks can rely on the header corresponding to the body, like with concrete blocks.

Required Associated Constants§

Required Associated Types§

Source

type Header: GenericBlockHeader<'a>

Block header type

Source

type Body: GenericBlockBody<'a>

Block body type

Source

type Owned: GenericOwnedBlock<Block<'a> = Self>
where Self: 'a,

Owned block

Required Methods§

Source

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

Get block header

Source

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

Get block body

Source

fn to_owned(self) -> Self::Owned

Turn into an owned version

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§