pub struct StateOverridesBuilder { /* private fields */ }
Expand description
A builder type for StateOverride
.
Implementations§
Source§impl StateOverridesBuilder
impl StateOverridesBuilder
Sourcepub const fn new(map: AddressHashMap<AccountOverride>) -> Self
pub const fn new(map: AddressHashMap<AccountOverride>) -> Self
Create a new StateOverridesBuilder.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new StateOverridesBuilder
with the given capacity.
Sourcepub fn append(self, address: Address, account_override: AccountOverride) -> Self
pub fn append(self, address: Address, account_override: AccountOverride) -> Self
Adds an account override for a specific address.
Sourcepub fn append_opt<F>(self, f: F) -> Self
pub fn append_opt<F>(self, f: F) -> Self
Helper append
function that appends an optional override.
Sourcepub fn apply<F>(self, f: F) -> Selfwhere
F: FnOnce(Self) -> Self,
pub fn apply<F>(self, f: F) -> Selfwhere
F: FnOnce(Self) -> Self,
Apply a function to the builder, returning the modified builder.
Sourcepub fn extend<I>(self, account_overrides: I) -> Self
pub fn extend<I>(self, account_overrides: I) -> Self
Adds multiple account overrides from an iterator.
Sourcepub fn build(self) -> StateOverride
pub fn build(self) -> StateOverride
Get the underlying StateOverride
.
Sourcepub fn with_balance(self, address: Address, balance: U256) -> Self
pub fn with_balance(self, address: Address, balance: U256) -> Self
Configures an account override with a balance.
Sourcepub fn with_nonce(self, address: Address, nonce: u64) -> Self
pub fn with_nonce(self, address: Address, nonce: u64) -> Self
Configures an account override with a nonce.
Sourcepub fn with_code(self, address: Address, code: impl Into<Bytes>) -> Self
pub fn with_code(self, address: Address, code: impl Into<Bytes>) -> Self
Configures an account override with bytecode.
Sourcepub fn with_state(
self,
address: Address,
state: impl IntoIterator<Item = (B256, B256)>,
) -> Self
pub fn with_state( self, address: Address, state: impl IntoIterator<Item = (B256, B256)>, ) -> Self
Configures an account override with state overrides.
Sourcepub fn with_state_diff(
self,
address: Address,
state_diff: impl IntoIterator<Item = (B256, B256)>,
) -> Self
pub fn with_state_diff( self, address: Address, state_diff: impl IntoIterator<Item = (B256, B256)>, ) -> Self
Configures an account override with state diffs.
Trait Implementations§
Source§impl Clone for StateOverridesBuilder
impl Clone for StateOverridesBuilder
Source§fn clone(&self) -> StateOverridesBuilder
fn clone(&self) -> StateOverridesBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for StateOverridesBuilder
impl Debug for StateOverridesBuilder
Source§impl Default for StateOverridesBuilder
impl Default for StateOverridesBuilder
Source§fn default() -> StateOverridesBuilder
fn default() -> StateOverridesBuilder
Returns the “default value” for a type. Read more
Source§impl From<StateOverridesBuilder> for StateOverride
Allows converting StateOverridesBuilder
directly into StateOverride
.
impl From<StateOverridesBuilder> for StateOverride
Allows converting StateOverridesBuilder
directly into StateOverride
.
Source§fn from(builder: StateOverridesBuilder) -> Self
fn from(builder: StateOverridesBuilder) -> Self
Converts to this type from the input type.
Source§impl FromIterator<(Address, AccountOverride)> for StateOverridesBuilder
impl FromIterator<(Address, AccountOverride)> for StateOverridesBuilder
Source§fn from_iter<T: IntoIterator<Item = (Address, AccountOverride)>>(
iter: T,
) -> Self
fn from_iter<T: IntoIterator<Item = (Address, AccountOverride)>>( iter: T, ) -> Self
Creates a value from an iterator. Read more
Source§impl PartialEq for StateOverridesBuilder
impl PartialEq for StateOverridesBuilder
impl Eq for StateOverridesBuilder
impl StructuralPartialEq for StateOverridesBuilder
Auto Trait Implementations§
impl Freeze for StateOverridesBuilder
impl RefUnwindSafe for StateOverridesBuilder
impl Send for StateOverridesBuilder
impl Sync for StateOverridesBuilder
impl Unpin for StateOverridesBuilder
impl UnwindSafe for StateOverridesBuilder
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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