Trait sp_runtime::traits::Block
source · pub trait Block: HeaderProvider<HeaderT = Self::Header> + Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + 'static {
type Extrinsic: Member + Codec + Extrinsic + MaybeSerialize;
type Header: Header<Hash = Self::Hash> + MaybeSerializeDeserialize;
type Hash: HashOutput;
// Required methods
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> ⓘ;
// Provided method
fn hash(&self) -> Self::Hash { ... }
}
Expand description
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
.
Required Associated Types§
sourcetype Header: Header<Hash = Self::Hash> + MaybeSerializeDeserialize
type Header: Header<Hash = Self::Hash> + MaybeSerializeDeserialize
Header type.
sourcetype Hash: HashOutput
type Hash: HashOutput
Block hash type.
Required Methods§
sourcefn extrinsics(&self) -> &[Self::Extrinsic]
fn extrinsics(&self) -> &[Self::Extrinsic]
Returns a reference to the list of extrinsics.
sourcefn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic>)
fn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic>)
Split the block into header and list of extrinsics.
Provided Methods§
Object Safety§
This trait is not object safe.