Skip to main content

Header

Trait Header 

Source
pub trait Header:
    Sized
    + Encode
    + Decode {
    type Number: Into<u64>;
    type Hasher: Hasher;

    // Required method
    fn number(&self) -> Self::Number;

    // Provided method
    fn hash_with(
        &self,
        hasher: Self::Hasher,
    ) -> <Self::Hasher as Hasher>::Output { ... }
}
Expand description

This represents the block header type used by a node.

Required Associated Types§

Source

type Number: Into<u64>

The block number type for this header.

Source

type Hasher: Hasher

The hasher used to hash this header.

Required Methods§

Source

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

Return the block number of this header.

Provided Methods§

Source

fn hash_with(&self, hasher: Self::Hasher) -> <Self::Hasher as Hasher>::Output

Hash this header.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<N, H> Header for SubstrateHeader<N, H>
where N: Copy + Into<u64> + Into<U256> + TryFrom<U256> + Encode, H: Hasher, SubstrateHeader<N, H>: Encode + Decode,