pub struct BlockBuilder { /* private fields */ }
Expand description

An advanced builder for BlockView.

Base on packed::BlockBuilder but added lots of syntactic sugar.

Implementations§

source§

impl BlockBuilder

source

pub fn version(self, v: Uint32) -> Self

Sets header.version.

source

pub fn parent_hash(self, v: Byte32) -> Self

Sets header.parent_hash.

source

pub fn timestamp(self, v: Uint64) -> Self

Sets header.timestamp.

source

pub fn number(self, v: Uint64) -> Self

Sets header.number.

source

pub fn transactions_root(self, v: Byte32) -> Self

Sets header.transactions_root.

source

pub fn proposals_hash(self, v: Byte32) -> Self

Sets header.proposals_hash.

source

pub fn compact_target(self, v: Uint32) -> Self

Sets header.compact_target.

source

pub fn extra_hash(self, v: Byte32) -> Self

Sets header.extra_hash.

source

pub fn epoch(self, v: Uint64) -> Self

Sets header.epoch.

source

pub fn dao(self, v: Byte32) -> Self

Sets header.dao.

source

pub fn nonce(self, v: Uint128) -> Self

Sets header.nonce.

source

pub fn uncle(self, v: UncleBlockView) -> Self

Pushes an item into uncles.

source

pub fn uncles<T>(self, v: T) -> Selfwhere T: IntoIterator<Item = UncleBlockView>,

Extends uncles with the contents of an iterator.

source

pub fn set_uncles(self, v: Vec<UncleBlockView>) -> Self

Sets uncles.

source

pub fn transaction(self, v: TransactionView) -> Self

Pushes an item into transactions.

source

pub fn transactions<T>(self, v: T) -> Selfwhere T: IntoIterator<Item = TransactionView>,

Extends transactions with the contents of an iterator.

source

pub fn set_transactions(self, v: Vec<TransactionView>) -> Self

Sets transactions.

source

pub fn proposal(self, v: ProposalShortId) -> Self

Pushes an item into proposals.

source

pub fn proposals<T>(self, v: T) -> Selfwhere T: IntoIterator<Item = ProposalShortId>,

Extends proposals with the contents of an iterator.

source

pub fn set_proposals(self, v: Vec<ProposalShortId>) -> Self

Sets proposals.

source

pub fn header(self, header: HeaderView) -> Self

Set header.

source

pub fn build(self) -> BlockView

Converts into BlockView and recalculates all hashes and merkle roots in the header.

source

pub fn build_unchecked(self) -> BlockView

Converts into BlockView but does not refresh all hashes and all merkle roots in the header.

Notice

BlockView created by this method could have invalid hashes or invalid merkle roots in the header.

Trait Implementations§

source§

impl Clone for BlockBuilder

source§

fn clone(&self) -> BlockBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BlockBuilder

source§

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

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

impl Default for BlockBuilder

source§

fn default() -> BlockBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V