pub struct Block {
pub ver: i32,
pub hash: Vec<u8>,
pub number: u64,
pub size: u64,
pub header: Option<BlockHeader>,
pub uncles: Vec<BlockHeader>,
pub transaction_traces: Vec<TransactionTrace>,
pub balance_changes: Vec<BalanceChange>,
pub code_changes: Vec<CodeChange>,
}
Fields
ver: i32
hash: Vec<u8>
number: u64
size: u64
header: Option<BlockHeader>
uncles: Vec<BlockHeader>
transaction_traces: Vec<TransactionTrace>
balance_changes: Vec<BalanceChange>
code_changes: Vec<CodeChange>
Implementations
sourceimpl Block
impl Block
sourcepub fn transactions(&self) -> impl Iterator<Item = &TransactionTrace>
pub fn transactions(&self) -> impl Iterator<Item = &TransactionTrace>
Iterates over succesful transactions.
sourcepub fn receipts(&self) -> impl Iterator<Item = ReceiptView<'_>>
pub fn receipts(&self) -> impl Iterator<Item = ReceiptView<'_>>
Iterates over transaction receipts of successful transactions.
sourcepub fn logs(&self) -> impl Iterator<Item = LogView<'_>>
pub fn logs(&self) -> impl Iterator<Item = LogView<'_>>
Iterates over logs in receipts of succesful transactions.
sourcepub fn events<'a, E: Event>(
&'a self,
addresses: &'a [&[u8]]
) -> impl Iterator<Item = (E, LogView<'_>)>
pub fn events<'a, E: Event>(
&'a self,
addresses: &'a [&[u8]]
) -> impl Iterator<Item = (E, LogView<'_>)>
A convenience for handlers that process a single type of event. Returns an iterator over
pairs of (event, log)
.
If you need to process multiple event types in a single handler, try something like:
for log in block.logs() {
if !addresses.contains(&log.address()) {
continue;
}
if let Some(event) = E1::match_and_decode(log) {
// Process events of type E1
} else if let Some(event) = E2::match_and_decode(log) {
// Process events of type E2
}
}
Trait Implementations
sourceimpl Message for Block
impl Message for Block
sourcefn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
sourcefn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
Encodes the message to a buffer. Read more
sourcefn encode_to_vec(&self) -> Vec<u8, Global>
fn encode_to_vec(&self) -> Vec<u8, Global>
Encodes the message to a newly allocated buffer.
sourcefn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
Encodes the message with a length-delimiter to a buffer. Read more
sourcefn encode_length_delimited_to_vec(&self) -> Vec<u8, Global>
fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global>
Encodes the message with a length-delimiter to a newly allocated buffer.
sourcefn decode<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
fn decode<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
Decodes an instance of the message from a buffer. Read more
sourcefn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
sourcefn merge<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
Decodes an instance of the message from a buffer, and merges it into self
. Read more
sourcefn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
Decodes a length-delimited instance of the message from buffer, and
merges it into self
. Read more
impl StructuralPartialEq for Block
Auto Trait Implementations
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more