Type Alias Block
pub type Block<T = TransactionSigned, H = Header> = Block<T, H>;
Expand description
Ethereum full block.
Withdrawals can be optionally included at the end of the RLP encoded message.
Aliased Type§
struct Block<T = TransactionSigned, H = Header> {
pub header: H,
pub body: BlockBody<T, H>,
}
Fields§
§header: H
Block header.
body: BlockBody<T, H>
Block body.
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.
Implementations
§impl<T, H> Block<T, H>
impl<T, H> Block<T, H>
pub const fn new(header: H, body: BlockBody<T, H>) -> Block<T, H>
pub const fn new(header: H, body: BlockBody<T, H>) -> Block<T, H>
Creates a new block with the given header and body.
pub fn uncle(header: H) -> Block<T, H>
pub fn uncle(header: H) -> Block<T, H>
Creates a new empty uncle block.
pub fn into_header(self) -> H
pub fn into_header(self) -> H
Consumes the block and returns the header.
pub fn into_body(self) -> BlockBody<T, H>
pub fn into_body(self) -> BlockBody<T, H>
Consumes the block and returns the body.
pub fn map_header<U>(self, f: impl FnMut(H) -> U) -> Block<T, U>
pub fn map_header<U>(self, f: impl FnMut(H) -> U) -> Block<T, U>
Converts the block’s header type by applying a function to it.
pub fn try_map_header<U, E>(
self,
f: impl FnMut(H) -> Result<U, E>,
) -> Result<Block<T, U>, E>
pub fn try_map_header<U, E>( self, f: impl FnMut(H) -> Result<U, E>, ) -> Result<Block<T, U>, E>
Converts the block’s header type by applying a fallible function to it.
pub fn convert_transactions<U>(self) -> Block<U, H>where
U: From<T>,
pub fn convert_transactions<U>(self) -> Block<U, H>where
U: From<T>,
Converts the block’s transaction type to the given alternative that is From<T>
pub fn try_convert_transactions<U>(
self,
) -> Result<Block<U, H>, <U as TryFrom<T>>::Error>where
U: TryFrom<T>,
pub fn try_convert_transactions<U>(
self,
) -> Result<Block<U, H>, <U as TryFrom<T>>::Error>where
U: TryFrom<T>,
Converts the block’s transaction to the given alternative that is TryFrom<T>
Returns the block with the new transaction type if all conversions were successful.
pub fn map_transactions<U>(self, f: impl FnMut(T) -> U) -> Block<U, H>
pub fn map_transactions<U>(self, f: impl FnMut(T) -> U) -> Block<U, H>
Converts the block’s transaction type by applying a function to each transaction.
Returns the block with the new transaction type.
pub fn try_map_transactions<U, E>(
self,
f: impl FnMut(T) -> Result<U, E>,
) -> Result<Block<U, H>, E>
pub fn try_map_transactions<U, E>( self, f: impl FnMut(T) -> Result<U, E>, ) -> Result<Block<U, H>, E>
Converts the block’s transaction type by applying a fallible function to each transaction.
Returns the block with the new transaction type if all transactions were successfully.
pub fn rlp_length_for(header: &H, body: &BlockBody<T, H>) -> usizewhere
H: Encodable,
T: Encodable,
pub fn rlp_length_for(header: &H, body: &BlockBody<T, H>) -> usizewhere
H: Encodable,
T: Encodable,
Returns the RLP encoded length of the block’s header and body.
Trait Implementations
§impl<'a, T, H> Arbitrary<'a> for Block<T, H>
Available on crate feature arbitrary
only.
impl<'a, T, H> Arbitrary<'a> for Block<T, H>
arbitrary
only.§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Block<T, H>, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Block<T, H>, Error>
Self
from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read more§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read more§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read more§impl<T, H> Block for Block<T, H>where
T: SignedTransaction,
H: BlockHeader,
impl<T, H> Block for Block<T, H>where
T: SignedTransaction,
H: BlockHeader,
§type Body = BlockBody<T, H>
type Body = BlockBody<T, H>
§fn new(
header: <Block<T, H> as Block>::Header,
body: <Block<T, H> as Block>::Body,
) -> Block<T, H>
fn new( header: <Block<T, H> as Block>::Header, body: <Block<T, H> as Block>::Body, ) -> Block<T, H>
§fn split(self) -> (<Block<T, H> as Block>::Header, <Block<T, H> as Block>::Body)
fn split(self) -> (<Block<T, H> as Block>::Header, <Block<T, H> as Block>::Body)
§fn rlp_length(
header: &<Block<T, H> as Block>::Header,
body: &<Block<T, H> as Block>::Body,
) -> usize
fn rlp_length( header: &<Block<T, H> as Block>::Header, body: &<Block<T, H> as Block>::Body, ) -> usize
§fn new_sealed(
header: SealedHeader<Self::Header>,
body: Self::Body,
) -> SealedBlock<Self>
fn new_sealed( header: SealedHeader<Self::Header>, body: Self::Body, ) -> SealedBlock<Self>
§fn seal_unchecked(self, hash: FixedBytes<32>) -> SealedBlock<Self>
fn seal_unchecked(self, hash: FixedBytes<32>) -> SealedBlock<Self>
§fn seal(self) -> SealedBlock<Self>
fn seal(self) -> SealedBlock<Self>
SealedBlock
from the block’s parts without calculating the hash upfront.§fn seal_slow(self) -> SealedBlock<Self>
fn seal_slow(self) -> SealedBlock<Self>
§fn split_ref(&self) -> (&Self::Header, &Self::Body)
fn split_ref(&self) -> (&Self::Header, &Self::Body)
§fn into_header(self) -> Self::Header
fn into_header(self) -> Self::Header
§fn recover_signers(&self) -> Result<Vec<Address>, RecoveryError>
fn recover_signers(&self) -> Result<Vec<Address>, RecoveryError>
§fn try_into_recovered_unchecked(
self,
senders: Vec<Address>,
) -> Result<RecoveredBlock<Self>, BlockRecoveryError<Self>>
fn try_into_recovered_unchecked( self, senders: Vec<Address>, ) -> Result<RecoveredBlock<Self>, BlockRecoveryError<Self>>
RecoveredBlock
using the given senders. Read more§fn into_recovered_with_signers(
self,
signers: Vec<Address>,
) -> RecoveredBlock<Self>
fn into_recovered_with_signers( self, signers: Vec<Address>, ) -> RecoveredBlock<Self>
RecoveredBlock
using the given signers. Read more§fn try_into_recovered(
self,
) -> Result<RecoveredBlock<Self>, BlockRecoveryError<Self>>
fn try_into_recovered( self, ) -> Result<RecoveredBlock<Self>, BlockRecoveryError<Self>>
RecoveredBlock
by recovering senders in the contained
transactions. Read more§impl<T, H> Decodable for Block<T, H>where
T: Decodable,
H: Decodable,
impl<T, H> Decodable for Block<T, H>where
T: Decodable,
H: Decodable,
§impl<'de, T, H> Deserialize<'de> for Block<T, H>where
T: Deserialize<'de>,
H: Deserialize<'de>,
impl<'de, T, H> Deserialize<'de> for Block<T, H>where
T: Deserialize<'de>,
H: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Block<T, H>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Block<T, H>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl<T, H> Encodable for Block<T, H>where
T: Encodable,
H: Encodable,
impl<T, H> Encodable for Block<T, H>where
T: Encodable,
H: Encodable,
§impl<T, H> EthBlock for Block<T, H>
impl<T, H> EthBlock for Block<T, H>
§fn withdrawals(&self) -> Option<&Withdrawals>
fn withdrawals(&self) -> Option<&Withdrawals>
§impl<'a, T, H> From<Block<'a, T, H>> for Block<T, H>where
T: SerdeBincodeCompat,
H: SerdeBincodeCompat,
impl<'a, T, H> From<Block<'a, T, H>> for Block<T, H>where
T: SerdeBincodeCompat,
H: SerdeBincodeCompat,
§impl<T, H> InMemorySize for Block<T, H>where
T: InMemorySize,
H: InMemorySize,
impl<T, H> InMemorySize for Block<T, H>where
T: InMemorySize,
H: InMemorySize,
§impl<T, H> SerdeBincodeCompat for Block<T, H>where
T: SerdeBincodeCompat,
H: SerdeBincodeCompat,
impl<T, H> SerdeBincodeCompat for Block<T, H>where
T: SerdeBincodeCompat,
H: SerdeBincodeCompat,
§type BincodeRepr<'a> = Block<'a, T, H>
type BincodeRepr<'a> = Block<'a, T, H>
§fn as_repr(&self) -> <Block<T, H> as SerdeBincodeCompat>::BincodeRepr<'_>
fn as_repr(&self) -> <Block<T, H> as SerdeBincodeCompat>::BincodeRepr<'_>
§fn from_repr(
repr: <Block<T, H> as SerdeBincodeCompat>::BincodeRepr<'_>,
) -> Block<T, H>
fn from_repr( repr: <Block<T, H> as SerdeBincodeCompat>::BincodeRepr<'_>, ) -> Block<T, H>
§impl<T, H> Serialize for Block<T, H>
impl<T, H> Serialize for Block<T, H>
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl<T, H> TestBlock for Block<T, H>where
T: SignedTransaction,
H: TestHeader,
Available on crate feature test-utils
only.
impl<T, H> TestBlock for Block<T, H>where
T: SignedTransaction,
H: TestHeader,
test-utils
only.