Struct alloy_consensus::Block
source · pub struct Block<T, H = Header> {
pub header: H,
pub body: BlockBody<T>,
}
Expand description
Ethereum full block.
Withdrawals can be optionally included at the end of the RLP encoded message.
Taken from reth-primitives
See p2p block encoding reference: https://github.com/ethereum/devp2p/blob/master/caps/eth.md#block-encoding-and-validity
Fields§
§header: H
Block header.
body: BlockBody<T>
Block body.
Implementations§
source§impl<T, H> Block<T, H>
impl<T, H> Block<T, H>
sourcepub fn into_header(self) -> H
pub fn into_header(self) -> H
Consumes the block and returns the header.
sourcepub fn map_header<U>(self, f: impl FnOnce(H) -> U) -> Block<T, U>
pub fn map_header<U>(self, f: impl FnOnce(H) -> U) -> Block<T, U>
Converts the block’s header type by applying a function to it.
sourcepub fn try_map_header<U, E>(
self,
f: impl FnOnce(H) -> Result<U, E>,
) -> Result<Block<T, U>, E>
pub fn try_map_header<U, E>( self, f: impl FnOnce(H) -> Result<U, E>, ) -> Result<Block<T, U>, E>
Converts the block’s header type by applying a fallible function to it.
sourcepub 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.
Trait Implementations§
source§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>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: PartialEq, H: PartialEq> PartialEq for Block<T, H>
impl<T: PartialEq, H: PartialEq> PartialEq for Block<T, H>
impl<T: Eq, H: Eq> Eq for Block<T, H>
impl<T, H> StructuralPartialEq for Block<T, H>
Auto Trait Implementations§
impl<T, H> Freeze for Block<T, H>where
H: Freeze,
impl<T, H> RefUnwindSafe for Block<T, H>where
H: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, H> Send for Block<T, H>
impl<T, H> Sync for Block<T, H>
impl<T, H> Unpin for Block<T, H>
impl<T, H> UnwindSafe for Block<T, H>where
H: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.