pub struct Block<T = Transaction, H = Header> {
pub header: H,
pub uncles: Vec<FixedBytes<32>>,
pub transactions: BlockTransactions<T>,
pub withdrawals: Option<Withdrawals>,
}
Available on crate feature
eth
only.Expand description
Block representation
Fields§
§header: H
Header of the block.
uncles: Vec<FixedBytes<32>>
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, H> Block<T, H>where
T: TransactionResponse,
impl<T, H> Block<T, H>where
T: TransactionResponse,
Sourcepub fn into_full_block(self, txs: Vec<T>) -> Block<T, H>
pub fn into_full_block(self, txs: Vec<T>) -> Block<T, H>
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) -> Block<T>
pub fn uncle_from_header(header: Header) -> Block<T>
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, H> BlockResponse for Block<T, H>where
T: TransactionResponse,
impl<T, H> BlockResponse for Block<T, H>where
T: TransactionResponse,
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<<Block<T, H> as BlockResponse>::Transaction>
fn transactions_mut( &mut self, ) -> &mut BlockTransactions<<Block<T, H> as BlockResponse>::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<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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T, H> Serialize for Block<T, H>
impl<T, H> Serialize for Block<T, H>
Source§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,
Serialize this value into the given Serde serializer. Read more
impl<T, H> 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