Header

Trait Header 

Source
pub trait Header:
    Clone
    + Send
    + Sync
    + Codec
    + Eq
    + MaybeSerialize
    + Debug
    + MaybeMallocSizeOf
    + 'static {
    type Number: Member + MaybeSerializeDeserialize + Debug + Hash + Copy + MaybeDisplay + AtLeast32BitUnsigned + Codec + FromStr + MaybeMallocSizeOf;
    type Hash: Member + MaybeSerializeDeserialize + Debug + Hash + Ord + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]> + MaybeMallocSizeOf;
    type Hashing: Hash<Output = Self::Hash>;

    // Required methods
    fn new(
        number: Self::Number,
        extrinsics_root: Self::Hash,
        state_root: Self::Hash,
        parent_hash: Self::Hash,
        digest: Digest<Self::Hash>,
    ) -> Self;
    fn number(&self) -> &Self::Number;
    fn set_number(&mut self, number: Self::Number);
    fn extrinsics_root(&self) -> &Self::Hash;
    fn set_extrinsics_root(&mut self, root: Self::Hash);
    fn state_root(&self) -> &Self::Hash;
    fn set_state_root(&mut self, root: Self::Hash);
    fn parent_hash(&self) -> &Self::Hash;
    fn set_parent_hash(&mut self, hash: Self::Hash);
    fn digest(&self) -> &Digest<Self::Hash>;
    fn digest_mut(&mut self) -> &mut Digest<Self::Hash>;

    // Provided method
    fn hash(&self) -> Self::Hash { ... }
}
Expand description

Something which fulfills the abstract idea of a Tetcore header. It has types for a Number, a Hash and a Hashing. It provides access to an extrinsics_root, state_root and parent_hash, as well as a digest and a block number.

You can also create a new one from those fields.

Required Associated Types§

Required Methods§

Source

fn new( number: Self::Number, extrinsics_root: Self::Hash, state_root: Self::Hash, parent_hash: Self::Hash, digest: Digest<Self::Hash>, ) -> Self

Creates new header.

Source

fn number(&self) -> &Self::Number

Returns a reference to the header number.

Source

fn set_number(&mut self, number: Self::Number)

Sets the header number.

Source

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

Returns a reference to the extrinsics root.

Source

fn set_extrinsics_root(&mut self, root: Self::Hash)

Sets the extrinsic root.

Source

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

Returns a reference to the state root.

Source

fn set_state_root(&mut self, root: Self::Hash)

Sets the state root.

Source

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

Returns a reference to the parent hash.

Source

fn set_parent_hash(&mut self, hash: Self::Hash)

Sets the parent hash.

Source

fn digest(&self) -> &Digest<Self::Hash>

Returns a reference to the digest.

Source

fn digest_mut(&mut self) -> &mut Digest<Self::Hash>

Get a mutable reference to the digest.

Provided Methods§

Source

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

Returns the hash of the header.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§