pub struct TestBlockV1Builder { /* private fields */ }Available on crate features
std and testing only.Expand description
A helper to build the blocks with various properties required for tests.
Implementations§
Source§impl TestBlockV1Builder
impl TestBlockV1Builder
Sourcepub fn parent_hash(self, parent_hash: BlockHash) -> Self
pub fn parent_hash(self, parent_hash: BlockHash) -> Self
Sets the parent hash for the block.
Sourcepub fn state_root_hash(self, state_root_hash: Digest) -> Self
pub fn state_root_hash(self, state_root_hash: Digest) -> Self
Sets the state root hash for the block.
Sourcepub fn protocol_version(self, protocol_version: ProtocolVersion) -> Self
pub fn protocol_version(self, protocol_version: ProtocolVersion) -> Self
Sets the protocol version for the block.
Sourcepub fn deploys<'a, I: IntoIterator<Item = &'a Deploy>>(
self,
deploys_iter: I,
) -> Self
pub fn deploys<'a, I: IntoIterator<Item = &'a Deploy>>( self, deploys_iter: I, ) -> Self
Associates the given deploys with the created block.
Sourcepub fn random_deploys(self, count: usize, rng: &mut TestRng) -> Self
pub fn random_deploys(self, count: usize, rng: &mut TestRng) -> Self
Associates a number of random deploys with the created block.
Sourcepub fn switch_block(self, is_switch: bool) -> Self
pub fn switch_block(self, is_switch: bool) -> Self
Allows setting the created block to be switch block or not.
Sourcepub fn validator_weights(self, validator_weights: ValidatorWeights) -> Self
pub fn validator_weights(self, validator_weights: ValidatorWeights) -> Self
Sets the validator weights for the block.
Sourcepub fn build_versioned(self, rng: &mut TestRng) -> Block
pub fn build_versioned(self, rng: &mut TestRng) -> Block
Builds the block as a versioned block.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestBlockV1Builder
impl RefUnwindSafe for TestBlockV1Builder
impl Send for TestBlockV1Builder
impl Sync for TestBlockV1Builder
impl Unpin for TestBlockV1Builder
impl UnwindSafe for TestBlockV1Builder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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