pub struct Block<T, H = Header> {
pub header: H,
pub body: BlockBody<T, H>,
}
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, H>
Block body.
Implementations§
Source§impl<T, H> Block<T, H>
impl<T, H> Block<T, H>
Sourcepub const fn new(header: H, body: BlockBody<T, H>) -> Self
pub const fn new(header: H, body: BlockBody<T, H>) -> Self
Creates a new block with the given header and body.
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 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.
Sourcepub 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.
Sourcepub 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>
Sourcepub fn try_convert_transactions<U>(self) -> Result<Block<U, H>, U::Error>where
U: TryFrom<T>,
pub fn try_convert_transactions<U>(self) -> Result<Block<U, H>, U::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.
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<'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.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self
from the given unstructured data. Read moreSource§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 moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read moreSource§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 moreSource§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>,
Source§impl<T, H> EthBlock for Block<T, H>
impl<T, H> EthBlock for Block<T, H>
Source§fn withdrawals(&self) -> Option<&Withdrawals>
fn withdrawals(&self) -> Option<&Withdrawals>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.