pub trait Block:
HeaderProvider<HeaderT = Self::Header>
+ Into<Self::LazyBlock>
+ EncodeLike<Self::LazyBlock>
+ Clone
+ Send
+ Sync
+ Codec
+ DecodeWithMemTracking
+ Eq
+ MaybeSerialize
+ Debug
+ 'static {
type Extrinsic: Member + Codec + ExtrinsicLike + MaybeSerialize + Into<OpaqueExtrinsic>;
type Header: Header<Hash = Self::Hash> + MaybeSerializeDeserialize;
type Hash: HashOutput;
type LazyBlock: LazyBlock<Extrinsic = Self::Extrinsic, Header = Self::Header> + EncodeLike<Self>;
// 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;
// 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 Extrinsic: Member + Codec + ExtrinsicLike + MaybeSerialize + Into<OpaqueExtrinsic>
type Extrinsic: Member + Codec + ExtrinsicLike + MaybeSerialize + Into<OpaqueExtrinsic>
Type for extrinsics.
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§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".