[][src]Trait sp_runtime::traits::Block

pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + MaybeMallocSizeOf + 'static {
    type Extrinsic: Member + Codec + Extrinsic + MaybeSerialize + MaybeMallocSizeOf;
    type Header: Header<Hash = Self::Hash> + MaybeMallocSizeOf;
    type Hash: Member + MaybeSerializeDeserialize + Debug + Hash + Ord + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]> + MaybeMallocSizeOf;
    pub fn header(&self) -> &Self::Header;
pub fn extrinsics(&self) -> &[Self::Extrinsic]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
pub fn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic>);
pub fn new(header: Self::Header, extrinsics: Vec<Self::Extrinsic>) -> Self;
pub fn encode_from(
        header: &Self::Header,
        extrinsics: &[Self::Extrinsic]
    ) -> Vec<u8>; pub fn hash(&self) -> Self::Hash { ... } }

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

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

Associated Types

Loading content...

Required methods

pub fn header(&self) -> &Self::Header[src]

Returns a reference to the header.

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

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Returns a reference to the list of extrinsics.

pub fn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic>)[src]

Split the block into header and list of extrinsics.

pub fn new(header: Self::Header, extrinsics: Vec<Self::Extrinsic>) -> Self[src]

Creates new block from header and extrinsics.

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

Creates an encoded block from the given header and extrinsics without requiring the creation of an instance.

Loading content...

Provided methods

pub fn hash(&self) -> Self::Hash[src]

Returns the hash of the block.

Loading content...

Implementors

impl<Header, Extrinsic: MaybeSerialize> Block for sp_runtime::generic::Block<Header, Extrinsic> where
    Header: HeaderT,
    Extrinsic: Member + Codec + Extrinsic + MaybeMallocSizeOf
[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 sp_runtime::testing::Block<Xt>[src]

type Extrinsic = Xt

type Header = Header

type Hash = <Header as Header>::Hash

Loading content...