[][src]Trait sr_primitives::traits::Block

pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebugButNotDeserialize + 'static {
    type Extrinsic: Member + Codec + Extrinsic + MaybeSerialize;
    type Header: Header<Hash = Self::Hash>;
    type Hash: Member + MaybeSerializeDebug + Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
    fn header(&self) -> &Self::Header;
fn extrinsics(&self) -> &[Self::Extrinsic];
fn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic>);
fn new(header: Self::Header, extrinsics: Vec<Self::Extrinsic>) -> Self;
fn encode_from(
        header: &Self::Header,
        extrinsics: &[Self::Extrinsic]
    ) -> Vec<u8>; fn hash(&self) -> Self::Hash { ... } }

Something which fulfills the abstract idea of a Substrate block. It has types for an Extrinsic piece of information as well as a Header.

You can get an iterator over each of the extrinsics and retrieve the header.

Associated Types

type Extrinsic: Member + Codec + Extrinsic + MaybeSerialize

Type of extrinsics.

type Header: Header<Hash = Self::Hash>

Header type.

type Hash: Member + MaybeSerializeDebug + Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>

Block hash type.

Loading content...

Required methods

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

Returns a reference to the header.

fn extrinsics(&self) -> &[Self::Extrinsic]

Returns a reference to the list of extrinsics.

fn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic>)

Split the block into header and list of extrinsics.

fn new(header: Self::Header, extrinsics: Vec<Self::Extrinsic>) -> Self

Creates new block from header and extrinsics.

fn encode_from(header: &Self::Header, extrinsics: &[Self::Extrinsic]) -> Vec<u8>

Create an encoded block from the given header and extrinsics without requiring to create an instance.

Loading content...

Provided methods

fn hash(&self) -> Self::Hash

Returns the hash of the block.

Loading content...

Implementors

impl<Header, Extrinsic: MaybeSerialize> Block for sr_primitives::generic::Block<Header, Extrinsic> where
    Header: HeaderT,
    Extrinsic: Member + Codec + Extrinsic
[src]

type Extrinsic = Extrinsic

type Header = Header

type Hash = <Self::Header as Header>::Hash

impl<Xt: 'static + Codec + Sized + Send + Sync + Serialize + Clone + Eq + Debug + Extrinsic> Block for sr_primitives::testing::Block<Xt>[src]

type Extrinsic = Xt

type Header = Header

type Hash = <Header as Header>::Hash

Loading content...