referrerpolicy=no-referrer-when-downgrade
penpal_runtime

Type Alias BlockId

Source
pub type BlockId = BlockId<Block>;
Expand description

BlockId type as expected by this runtime.

Aliased Type§

enum BlockId {
    Hash(H256),
    Number(u32),
}

Variants§

§

Hash(H256)

Identify by block header hash.

§

Number(u32)

Identify by block number.

Implementations

Source§

impl<Block> BlockId<Block>
where Block: Block,

Source

pub const fn hash(hash: <Block as Block>::Hash) -> BlockId<Block>

Create a block ID from a hash.

Source

pub const fn number( number: <<Block as Block>::Header as Header>::Number, ) -> BlockId<Block>

Create a block ID from a number.

Source

pub fn is_pre_genesis(&self) -> bool

Check if this block ID refers to the pre-genesis state.

Source

pub fn pre_genesis() -> BlockId<Block>

Create a block ID for a pre-genesis state.

Trait Implementations

Source§

impl<Block> Clone for BlockId<Block>
where Block: Clone + Block, <Block as Block>::Hash: Clone,

Source§

fn clone(&self) -> BlockId<Block>

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
Source§

impl<Block> Debug for BlockId<Block>
where Block: Block + Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<Block> Decode for BlockId<Block>
where Block: Block, <Block as Block>::Hash: Decode, <<Block as Block>::Header as Header>::Number: Decode,

Source§

fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<BlockId<Block>, Error>
where __CodecInputEdqy: Input,

Attempt to deserialise the value from input.
§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
Source§

impl<Block> Display for BlockId<Block>
where Block: Block,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<Block> Encode for BlockId<Block>
where Block: Block, <Block as Block>::Hash: Encode, <<Block as Block>::Header as Header>::Number: Encode,

Source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
Source§

fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
where __CodecOutputEdqy: Output + ?Sized,

Convert self to a slice and append it to the destination.
§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
§

fn using_encoded<R, F>(&self, f: F) -> R
where F: FnOnce(&[u8]) -> R,

Convert self to a slice and then invoke the given closure with it.
§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
Source§

impl<Block> PartialEq for BlockId<Block>
where Block: PartialEq + Block, <Block as Block>::Hash: PartialEq,

Source§

fn eq(&self, other: &BlockId<Block>) -> 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.
Source§

impl<Block> Copy for BlockId<Block>
where Block: Block,

Source§

impl<Block> EncodeLike for BlockId<Block>
where Block: Block, <Block as Block>::Hash: Encode, <<Block as Block>::Header as Header>::Number: Encode,

Source§

impl<Block> Eq for BlockId<Block>
where Block: Eq + Block, <Block as Block>::Hash: Eq,

Source§

impl<Block> StructuralPartialEq for BlockId<Block>
where Block: Block,