Type Alias SealedHeaderFor

pub type SealedHeaderFor<N> = SealedHeader<<N as NodePrimitives>::BlockHeader>;
Expand description

Type alias for SealedHeader generic over the BlockHeader type of NodePrimitives.

Aliased Type§

struct SealedHeaderFor<N> { /* private fields */ }

Layout§

Note: Encountered an error during type layout; the type failed to be normalized.

Implementations

§

impl<H> SealedHeader<&H>
where H: Sealable,

pub fn cloned(self) -> SealedHeader<H>
where H: Clone,

Maps a SealedHeader<&H> to a SealedHeader<H> by cloning the header.

§

impl<H> SealedHeader<H>

pub fn new_unhashed(header: H) -> SealedHeader<H>

Creates the sealed header without hashing the header.

pub fn new(header: H, hash: FixedBytes<32>) -> SealedHeader<H>

Creates the sealed header with the corresponding block hash.

pub const fn header(&self) -> &H

Returns the sealed Header fields.

pub fn clone_header(&self) -> H
where H: Clone,

Clone the header.

pub fn into_header(self) -> H

Consumes the type and returns the wrapped header.

pub fn unseal(self) -> H

Consumes the type and returns the wrapped header.

pub fn sealed_ref(&self) -> SealedHeader<&H>

Converts from &SealedHeader<H> to SealedHeader<&H>.

§

impl<H> SealedHeader<H>
where H: TestHeader,

pub fn set_header(&mut self, header: H)

Available on crate feature test-utils only.

Updates the block header.

pub fn set_hash(&mut self, hash: FixedBytes<32>)

Available on crate feature test-utils only.

Updates the block hash.

pub fn header_mut(&mut self) -> &mut H

Available on crate feature test-utils only.

Returns a mutable reference to the header.

pub fn set_parent_hash(&mut self, hash: FixedBytes<32>)

Available on crate feature test-utils only.

Updates the parent block hash.

pub fn set_block_number(&mut self, number: u64)

Available on crate feature test-utils only.

Updates the block number.

pub fn set_state_root(&mut self, state_root: FixedBytes<32>)

Available on crate feature test-utils only.

Updates the block state root.

pub fn set_difficulty(&mut self, difficulty: Uint<256, 4>)

Available on crate feature test-utils only.

Updates the block difficulty.

§

impl<H> SealedHeader<H>
where H: BlockHeader + Sealable,

pub fn num_hash(&self) -> NumHash

Return the number hash tuple.

pub fn block_with_parent(&self) -> BlockWithParent

Return a [BlockWithParent] for this header.

§

impl<H> SealedHeader<H>
where H: Sealable,

pub fn seal_slow(header: H) -> SealedHeader<H>

Hashes the header and creates a sealed header.

pub fn hash_ref(&self) -> &FixedBytes<32>

Returns the block hash.

Note: if the hash has not been computed yet, this will compute the hash: [Sealable::hash_slow].

pub fn hash(&self) -> FixedBytes<32>

Returns a copy of the block hash.

pub fn split(self) -> (H, FixedBytes<32>)

This is the inverse of Header::seal_slow which returns the raw header and hash.

Trait Implementations

§

impl<'a, H> Arbitrary<'a> for SealedHeader<H>
where H: for<'b> Arbitrary<'b> + Sealable,

Available on crate feature arbitrary only.
§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<SealedHeader<H>, Error>

Generate an arbitrary value of Self from the given unstructured data. Read more
§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
§

impl<H> AsRef<H> for SealedHeader<H>

§

fn as_ref(&self) -> &H

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<H> Clone for SealedHeader<H>
where H: Clone,

§

fn clone(&self) -> SealedHeader<H>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<H> Debug for SealedHeader<H>
where H: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Decodable for SealedHeader

§

fn decode(buf: &mut &[u8]) -> Result<SealedHeader, Error>

Decodes the blob into the appropriate type. buf must be advanced past the decoded object.
§

impl<H> Default for SealedHeader<H>
where H: Sealable + Default,

§

fn default() -> SealedHeader<H>

Returns the “default value” for a type. Read more
§

impl<H> Deref for SealedHeader<H>

§

type Target = H

The resulting type after dereferencing.
§

fn deref(&self) -> &<SealedHeader<H> as Deref>::Target

Dereferences the value.
§

impl<'de, H> Deserialize<'de> for SealedHeader<H>
where H: Deserialize<'de>,

§

fn deserialize<__D>( __deserializer: __D, ) -> Result<SealedHeader<H>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Encodable for SealedHeader

§

fn encode(&self, out: &mut dyn BufMut)

Encodes the type into the out buffer.
§

fn length(&self) -> usize

Returns the length of the encoding of this type in bytes. Read more
§

impl<'a, H> From<SealedHeader<'a, H>> for SealedHeader<H>
where H: Sealable + SerdeBincodeCompat,

§

fn from(value: SealedHeader<'a, H>) -> SealedHeader<H>

Converts to this type from the input type.
§

impl<H> Hash for SealedHeader<H>
where H: Sealable,

§

fn hash<Ha>(&self, state: &mut Ha)
where Ha: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<H> InMemorySize for SealedHeader<H>
where H: InMemorySize,

§

fn size(&self) -> usize

Calculates a heuristic for the in-memory size of the SealedHeader.

§

impl<H> PartialEq for SealedHeader<H>
where H: Sealable,

§

fn eq(&self, other: &SealedHeader<H>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<H> SerdeBincodeCompat for SealedHeader<H>
where H: Sealable + SerdeBincodeCompat,

§

type BincodeRepr<'a> = SealedHeader<'a, H>

Serde representation of the type for bincode serialization. Read more
§

fn as_repr(&self) -> <SealedHeader<H> as SerdeBincodeCompat>::BincodeRepr<'_>

Convert this type into its bincode representation
§

fn from_repr( repr: <SealedHeader<H> as SerdeBincodeCompat>::BincodeRepr<'_>, ) -> SealedHeader<H>

Convert from the bincode representation
§

impl<H> Serialize for SealedHeader<H>
where H: Serialize,

§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl<H> Eq for SealedHeader<H>
where H: Sealable,