Struct BlockWithTransactions

Source
#[non_exhaustive]
pub struct BlockWithTransactions { pub header: Block, pub precommits: Vec<Verified<Precommit>>, pub transactions: Vec<CommittedTransaction>, pub errors: Vec<ErrorWithLocation>, }
Expand description

Information about a block in the blockchain with info on transactions eagerly loaded.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§header: Block

Block header as recorded in the blockchain.

§precommits: Vec<Verified<Precommit>>

Precommits.

§transactions: Vec<CommittedTransaction>

Transactions in the order they appear in the block.

§errors: Vec<ErrorWithLocation>

Errors that have occurred within the block.

Implementations§

Source§

impl BlockWithTransactions

Source

pub fn height(&self) -> Height

Returns the height of this block.

This method is equivalent to calling block.header.height().

Source

pub fn len(&self) -> usize

Returns the number of transactions in this block.

Source

pub fn is_empty(&self) -> bool

Is this block empty (i.e., contains no transactions)?

Source

pub fn iter(&self) -> EagerTransactions<'_>

Iterates over transactions in the block.

Source

pub fn error_map(&self) -> BTreeMap<CallInBlock, &ExecutionError>

Returns errors converted into a map. Note that this is potentially a costly operation.

Trait Implementations§

Source§

impl Debug for BlockWithTransactions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BlockWithTransactions

Source§

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 Index<Hash> for BlockWithTransactions

Returns a transaction in the block by its hash. Beware that this is a slow operation (linear w.r.t. the number of transactions in a block).

Source§

type Output = CommittedTransaction

The returned type after indexing.
Source§

fn index(&self, index: Hash) -> &CommittedTransaction

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for BlockWithTransactions

Source§

type Output = CommittedTransaction

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &CommittedTransaction

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a> IntoIterator for &'a BlockWithTransactions

Source§

type Item = &'a CommittedTransaction

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, CommittedTransaction>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> EagerTransactions<'a>

Creates an iterator from a value. Read more
Source§

impl Serialize for BlockWithTransactions

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,