Trait polkadot_service::BlockT
source · pub trait BlockT: 'static + Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + MaybeMallocSizeOf {
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 + TypeInfo;
fn header(&self) -> &Self::Header;
fn extrinsics(&self) -> &[Self::Extrinsic];
fn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic, Global>);
fn new(
header: Self::Header,
extrinsics: Vec<Self::Extrinsic, Global>
) -> Self;
fn encode_from(
header: &Self::Header,
extrinsics: &[Self::Extrinsic]
) -> Vec<u8, Global> ⓘ;
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 + Extrinsic + MaybeSerialize + MaybeMallocSizeOf
type Extrinsic: Member + Codec + Extrinsic + MaybeSerialize + MaybeMallocSizeOf
Type for extrinsics.
sourcetype Header: Header<Hash = Self::Hash> + MaybeMallocSizeOf
type Header: Header<Hash = Self::Hash> + MaybeMallocSizeOf
Header type.
sourcetype Hash: Member + MaybeSerializeDeserialize + Debug + Hash + Ord + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]> + MaybeMallocSizeOf + TypeInfo
type Hash: Member + MaybeSerializeDeserialize + Debug + Hash + Ord + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]> + MaybeMallocSizeOf + TypeInfo
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, Global>)
fn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic, Global>)
Split the block into header and list of extrinsics.