pub struct Block<T = Transaction<TxEnvelope>, H = Header> {
pub header: H,
pub uncles: Vec<B256>,
pub transactions: BlockTransactions<T>,
pub withdrawals: Option<Withdrawals>,
}
Expand description
Block representation
Fields§
§header: H
Header of the block.
uncles: Vec<B256>
Uncles’ hashes.
transactions: BlockTransactions<T>
Block Transactions. In the case of an uncle block, this field is not included in RPC responses, and when deserialized, it will be set to BlockTransactions::Uncle.
withdrawals: Option<Withdrawals>
Withdrawals in the block.
Implementations§
Source§impl<T: TransactionResponse, H> Block<T, H>
impl<T: TransactionResponse, H> Block<T, H>
Sourcepub fn into_full_block(self, txs: Vec<T>) -> Self
pub fn into_full_block(self, txs: Vec<T>) -> Self
Converts a block with Tx hashes into a full block.
Source§impl<T> Block<T>
impl<T> Block<T>
Sourcepub fn uncle_from_header(header: Header) -> Self
pub fn uncle_from_header(header: Header) -> Self
Constructs an “uncle block” from the provided header.
This function creates a new Block
structure for uncle blocks (ommer blocks),
using the provided alloy_consensus::Header
.
Trait Implementations§
Source§impl<T: TransactionResponse, H> BlockResponse for Block<T, H>
impl<T: TransactionResponse, H> BlockResponse for Block<T, H>
Source§type Transaction = T
type Transaction = T
Transaction type
Source§fn transactions(&self) -> &BlockTransactions<T>
fn transactions(&self) -> &BlockTransactions<T>
Block transactions
Source§fn transactions_mut(&mut self) -> &mut BlockTransactions<Self::Transaction>
fn transactions_mut(&mut self) -> &mut BlockTransactions<Self::Transaction>
Mutable reference to block transactions
Source§fn other_fields(&self) -> Option<&OtherFields>
fn other_fields(&self) -> Option<&OtherFields>
Returns the
other
field from WithOtherFields
type.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
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
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§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>
Converts
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>
Converts
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 more