pub struct ExecutionLifecycle<F: FoundryEvmFactory> {
factory: F,
forks: ForkRegistry<F::Types>,
snapshots: StateSnapshots<LifecycleSnapshot<F::Types>>,
pending_env: Option<EvmEnv<F::Types>>,
tx_prewarm: Option<PrewarmSet>,
tx_original: AddressMap<Option<AccountInfo>>,
switch_slots: AddressMap<HashSet<U256>>,
}Expand description
Fork, snapshot and nested-execution lifecycle for one EVM network family.
Fields§
§factory: F§forks: ForkRegistry<F::Types>§snapshots: StateSnapshots<LifecycleSnapshot<F::Types>>§pending_env: Option<EvmEnv<F::Types>>§tx_prewarm: Option<PrewarmSet>Base warm set of the running transaction from before a fork switch carried warmth into it.
tx_original: AddressMap<Option<AccountInfo>>Transaction-start info of the persistent accounts a fork switch accepted the running transaction’s changes to.
switch_slots: AddressMap<HashSet<U256>>Warm slots of persistent accounts the last fork switch carried into the next context.
Implementations§
Source§impl<F: FoundryEvmFactory> ExecutionLifecycle<F>
impl<F: FoundryEvmFactory> ExecutionLifecycle<F>
Sourcepub fn new(factory: F, db: impl BackingDb, env: EvmEnv<F::Types>) -> Self
pub fn new(factory: F, db: impl BackingDb, env: EvmEnv<F::Types>) -> Self
Creates a lifecycle whose active context is local execution over db.
Sourcepub fn set_factory(&mut self, factory: F)
pub fn set_factory(&mut self, factory: F)
Replaces the factory used for EVMs built from now on.
Sourcepub const fn forks(&self) -> &ForkRegistry<F::Types>
pub const fn forks(&self) -> &ForkRegistry<F::Types>
Returns the fork registry.
Sourcepub const fn forks_mut(&mut self) -> &mut ForkRegistry<F::Types>
pub const fn forks_mut(&mut self) -> &mut ForkRegistry<F::Types>
Returns the fork registry mutably, for persistent-account changes.
Sourcepub fn active_mut(&mut self) -> &mut Parked<F::Types>
pub fn active_mut(&mut self) -> &mut Parked<F::Types>
Returns the active context mutably.
Use it between executions only: a running EVM holds its own view of the context.
Sourcepub fn refresh_switched_slot(
&mut self,
address: &Address,
slot: U256,
value: U256,
)
pub fn refresh_switched_slot( &mut self, address: &Address, slot: U256, value: U256, )
Records value as the accepted value of a slot the running transaction restored the
original of when it resumed the active context, such as after refreshing the slot from the
remote, so that a revert leaving the context keeps it.
Sourcepub fn accepted_mut(&mut self) -> &mut Cache
pub fn accepted_mut(&mut self) -> &mut Cache
Returns the active context’s accepted state for modification between executions, initializing the context first if it never ran.
Sourcepub fn accepted_db(&self) -> impl BackingDb + use<F>
pub fn accepted_db(&self) -> impl BackingDb + use<F>
Returns a database reading the active context’s accepted state over its backing database, for reads between executions.
Sourcepub fn has_snapshot(&self, id: U256) -> bool
pub fn has_snapshot(&self, id: U256) -> bool
Returns whether a snapshot exists.
Sourcepub fn create_evm<'a>(&self) -> Evm<'a, F::Types>
pub fn create_evm<'a>(&self) -> Evm<'a, F::Types>
Creates an EVM over the active context without copying its accepted state.
A context that never ran is initialized first (network genesis, sentinels). Pass the EVM to
Self::park to accept its state, or drop it to discard it.
Sourcepub fn park(&mut self, evm: Evm<'_, F::Types>)
pub fn park(&mut self, evm: Evm<'_, F::Types>)
Accepts evm’s state, environment and network extension state into the active context. A
fork keeps its own chain ID.
Call this between transactions, with an EVM created by Self::create_evm whose
executions were committed. In-flight state that was not committed is discarded, and a
deferred environment change is applied first.
Sourcepub(crate) fn park_detached(&mut self, evm: Evm<'_, F::Types>)
pub(crate) fn park_detached(&mut self, evm: Evm<'_, F::Types>)
Like Self::park, for an EVM whose executions were not committed, such as a call’s: its
pending writes are discarded, but the accepted state it carries, such as after a fork
switch, is kept.
Sourcefn accept(&mut self, evm: Evm<'_, F::Types>, committed: bool)
fn accept(&mut self, evm: Evm<'_, F::Types>, committed: bool)
Accepts evm’s state, environment and network extension state into the active context.
An EVM that materialized its accepted state holds the context’s whole accepted state, which
replaces the context’s. One that still reads it through a shared view only holds what its
executions read and, if committed, wrote, which is merged into the context’s; without
committed writes it only caches reads, so it is dropped rather than copying the shared
accepted state.
Sourcepub fn materialize(&self, evm: &mut Evm<'_, F::Types>)
pub fn materialize(&self, evm: &mut Evm<'_, F::Types>)
Materializes the accepted state evm reads through a shared view into its own overlay.
Operations that capture or replace the running state call this first; it copies the accepted state once per execution.
Sourcepub fn create_fork(
&mut self,
info: ForkInfo,
db: impl BackingDb,
env: EvmEnv<F::Types>,
) -> U256
pub fn create_fork( &mut self, info: ForkInfo, db: impl BackingDb, env: EvmEnv<F::Types>, ) -> U256
Registers a fork without selecting it and returns its local fork ID.
Sourcepub fn select_fork(
&mut self,
evm: &mut Evm<'_, F::Types>,
id: Option<U256>,
phase: ExecutionPhase,
) -> Result<()>
pub fn select_fork( &mut self, evm: &mut Evm<'_, F::Types>, id: Option<U256>, phase: ExecutionPhase, ) -> Result<()>
Makes id the running context, or the local context for None.
Persistent accounts carry their accepted state into the target. Leaving the local context makes what the running transaction loaded and created there the initial state of every fork.
Sourcepub const fn activate_detached(&mut self, id: Option<U256>)
pub const fn activate_detached(&mut self, id: Option<U256>)
Makes id the active context, or the local context for None, without suspending the
running state: for a throwaway copy of the lifecycle whose transaction already runs over
id’s state, such as one prepared with Self::prepare_on_inactive.
Sourcepub fn roll_fork(
&mut self,
evm: &mut Evm<'_, F::Types>,
id: Option<U256>,
db: impl BackingDb,
env: EvmEnv<F::Types>,
cache: Option<Cache>,
phase: ExecutionPhase,
) -> Result<()>
pub fn roll_fork( &mut self, evm: &mut Evm<'_, F::Types>, id: Option<U256>, db: impl BackingDb, env: EvmEnv<F::Types>, cache: Option<Cache>, phase: ExecutionPhase, ) -> Result<()>
Moves fork id, or the running context for None, onto a new backing database and
environment, such as a later block.
The fork starts over from the initial fork state, keeping persistent accounts and accounts created on the fork. Rolling the running context also keeps other loaded accounts, but reloads only their info from the new database, discarding their pre-roll storage slots.
With cache, the fork resumes with it as its accepted state, such as state replayed up to a
transaction.
Sourcepub fn replace_inactive(
&mut self,
id: Option<U256>,
db: impl BackingDb,
env: EvmEnv<F::Types>,
cache: Option<Cache>,
) -> Result<()>
pub fn replace_inactive( &mut self, id: Option<U256>, db: impl BackingDb, env: EvmEnv<F::Types>, cache: Option<Cache>, ) -> Result<()>
Moves the inactive fork id, or the local context for None, onto a new backing database
and environment, optionally with cache as its accepted state.
The fork’s accepted state is discarded except for persistent accounts and accounts created on it, and the fork starts over from the initial fork state.
Sourcepub const fn pending_env(&self) -> Option<&EvmEnv<F::Types>>
pub const fn pending_env(&self) -> Option<&EvmEnv<F::Types>>
Returns the environment change deferred by an in-flight operation, applied at the next transaction.
Sourcepub const fn tx_prewarm(&self) -> Option<&PrewarmSet>
pub const fn tx_prewarm(&self) -> Option<&PrewarmSet>
Returns the base warm set of the running transaction if a fork switch carried warmth into its warm set, which cooling the transaction’s state must restore.
Sourcepub fn remove_prewarm(&mut self, state: &mut State<'_>, address: &Address)
pub fn remove_prewarm(&mut self, state: &mut State<'_>, address: &Address)
Removes address from the running transaction’s base warmth in state and in the
warmth that fork switches and isolated static calls restore, so it stays cold until it is
accessed again.
Sourcepub fn tracks_prewarm(&self, address: &Address) -> bool
pub fn tracks_prewarm(&self, address: &Address) -> bool
Returns whether Self::remove_prewarm would change the lifecycle, not only state.
Sourcepub fn has_persistent_warmth(&self) -> bool
pub fn has_persistent_warmth(&self) -> bool
Returns whether any context keeps warmth of a persistent account for the running
transaction, which Self::take_persistent_warmth would take.
Sourcepub fn take_persistent_warmth(
&mut self,
) -> Vec<(Option<U256>, AddressMap<HashSet<U256>>)>
pub fn take_persistent_warmth( &mut self, ) -> Vec<(Option<U256>, AddressMap<HashSet<U256>>)>
Takes the warmth of persistent accounts that contexts kept for the running transaction, so
that a nested transaction, such as an isolated call, resumes them cold in every context.
Hand it back with Self::restore_persistent_warmth when the
nested transaction ends.
Sourcepub fn restore_persistent_warmth(
&mut self,
warmth: Vec<(Option<U256>, AddressMap<HashSet<U256>>)>,
)
pub fn restore_persistent_warmth( &mut self, warmth: Vec<(Option<U256>, AddressMap<HashSet<U256>>)>, )
Hands persistent warmth taken with Self::take_persistent_warmth back to its contexts.
Sourcepub fn begin_transaction(&mut self, evm: &mut Evm<'_, F::Types>)
pub fn begin_transaction(&mut self, evm: &mut Evm<'_, F::Types>)
Applies an environment change deferred by an in-flight operation and forgets the warmth contexts kept from the previous transaction. Call before every transaction.
Sourcepub fn set_env(
&mut self,
evm: &mut Evm<'_, F::Types>,
env: EvmEnv<F::Types>,
phase: ExecutionPhase,
)
pub fn set_env( &mut self, evm: &mut Evm<'_, F::Types>, env: EvmEnv<F::Types>, phase: ExecutionPhase, )
Switches evm to env. The block applies at once; a spec or chain ID change applies at
once between transactions and is deferred to the next transaction while one is in flight.
Sourcepub fn snapshot(&mut self, evm: &mut Evm<'_, F::Types>) -> U256
pub fn snapshot(&mut self, evm: &mut Evm<'_, F::Types>) -> U256
Captures the running context and every fork, and returns the snapshot ID.
Sourcepub fn revert(
&mut self,
evm: &mut Evm<'_, F::Types>,
id: U256,
action: RevertStateSnapshotAction,
phase: ExecutionPhase,
) -> Option<StateSnapshot>
pub fn revert( &mut self, evm: &mut Evm<'_, F::Types>, id: U256, action: RevertStateSnapshotAction, phase: ExecutionPhase, ) -> Option<StateSnapshot>
Restores snapshot id and returns the running state it replaced, or None if it does not
exist.
Logs emitted since the snapshot are kept. Only the context that was active at the snapshot
gets its state back and becomes active again; other contexts, persistent
accounts and forks created after the snapshot are left as they are.
The replaced state is materialized, so that a failing frame can reinstate it over a backing
database with SnapshotRestores.
Sourcepub fn delete_snapshot(&mut self, id: U256) -> bool
pub fn delete_snapshot(&mut self, id: U256) -> bool
Deletes a snapshot, returning whether it existed.
Sourcepub fn delete_snapshots(&mut self)
pub fn delete_snapshots(&mut self)
Deletes every snapshot.
Sourcepub fn nested_evm<'a>(
&self,
evm: &mut Evm<'_, F::Types>,
tx: &Recovered<<F::Types as EvmTypesHost>::Tx>,
env: Option<EvmEnv<F::Types>>,
ext: Option<<F::Types as EvmTypesHost>::EvmExt>,
) -> Evm<'a, F::Types>
pub fn nested_evm<'a>( &self, evm: &mut Evm<'_, F::Types>, tx: &Recovered<<F::Types as EvmTypesHost>::Tx>, env: Option<EvmEnv<F::Types>>, ext: Option<<F::Types as EvmTypesHost>::EvmExt>, ) -> Evm<'a, F::Types>
Builds the EVM a nested transaction of the running one executes on: a copy of the running
transaction’s current state, with env or the running environment, and ext or network
extension state derived from the running EVM for tx.
Sourcepub unsafe fn begin_frame_evm<'a>(
&self,
evm: &mut Evm<'_, F::Types>,
env: EvmEnv<F::Types>,
) -> Evm<'a, F::Types>
pub unsafe fn begin_frame_evm<'a>( &self, evm: &mut Evm<'_, F::Types>, env: EvmEnv<F::Types>, ) -> Evm<'a, F::Types>
Moves the transaction evm is running onto a separate frame EVM executing with env,
such as for deployCode or an in-flight spec change.
Execute messages on the returned EVM with Host::execute_message and hand its state back
with Self::end_frame_evm; evm must not execute in between.
§Safety
The running state of evm moves into the returned EVM, whose lifetime 'a the caller
chooses. Every database in that state must outlive 'a: it must be one the lifecycle
installed, all of which are owned ('static), not a database borrowed by the caller.
Sourcepub unsafe fn end_frame_evm(
&self,
evm: &mut Evm<'_, F::Types>,
frame: Evm<'_, F::Types>,
)
pub unsafe fn end_frame_evm( &self, evm: &mut Evm<'_, F::Types>, frame: Evm<'_, F::Types>, )
Hands the state, transaction environment, block and network extension state of a frame EVM
created with
Self::begin_frame_evm back to evm, restoring evm’s empty-account policy on the
active backing database.
§Safety
The running state of frame moves into evm. Every database in that state must outlive
evm: it must be one the lifecycle installed, as for Self::begin_frame_evm.
Sourcepub fn prepare_nested(
&self,
evm: &mut Evm<'_, F::Types>,
tx: Recovered<<F::Types as EvmTypesHost>::Tx>,
env: Option<EvmEnv<F::Types>>,
ext: Option<<F::Types as EvmTypesHost>::EvmExt>,
) -> PreparedTx<F::Types>
pub fn prepare_nested( &self, evm: &mut Evm<'_, F::Types>, tx: Recovered<<F::Types as EvmTypesHost>::Tx>, env: Option<EvmEnv<F::Types>>, ext: Option<<F::Types as EvmTypesHost>::EvmExt>, ) -> PreparedTx<F::Types>
Prepares tx to execute as a nested transaction of the running one on the EVM
Self::nested_evm builds.
Sourcepub fn prepare_on_inactive(
&self,
evm: &mut Evm<'_, F::Types>,
id: Option<U256>,
tx: Recovered<<F::Types as EvmTypesHost>::Tx>,
env: Option<EvmEnv<F::Types>>,
ext: Option<<F::Types as EvmTypesHost>::EvmExt>,
) -> Result<PreparedTx<F::Types>>
pub fn prepare_on_inactive( &self, evm: &mut Evm<'_, F::Types>, id: Option<U256>, tx: Recovered<<F::Types as EvmTypesHost>::Tx>, env: Option<EvmEnv<F::Types>>, ext: Option<<F::Types as EvmTypesHost>::EvmExt>, ) -> Result<PreparedTx<F::Types>>
Prepares tx to execute on the inactive fork id, or the local context for None, and
be accepted there, such as for vm.transact on another fork.
Persistent accounts carry the running transaction’s state into the fork, and the
transaction’s changes to them are merged back into the running transaction as journaled
writes. The running transaction’s other loaded accounts then take the fork’s resulting
state, see Self::rebase_onto_inactive.
Sourcepub fn store_executed(
&mut self,
executed: ExecutedNested<F::Types>,
) -> TxResult<F::Types>
pub fn store_executed( &mut self, executed: ExecutedNested<F::Types>, ) -> TxResult<F::Types>
Stores the outcome of a PreparedTx: an inactive context’s new accepted state.
Sourcepub fn rebase_onto_inactive(
&self,
evm: &mut Evm<'_, F::Types>,
id: Option<U256>,
) -> Result<()>
pub fn rebase_onto_inactive( &self, evm: &mut Evm<'_, F::Types>, id: Option<U256>, ) -> Result<()>
Replaces the accounts the running transaction of evm loaded, except persistent ones,
with their accepted state on the inactive fork id, or the local context for None, as
journaled writes, such as after replaying transactions there.
Sourcefn suspend(&mut self, evm: &mut Evm<'_, F::Types>) -> Suspended
fn suspend(&mut self, evm: &mut Evm<'_, F::Types>) -> Suspended
Accepts the running state and stores it, with the running environment, in the active context. A fork keeps its own chain ID. Returns what the running transaction carries into the next context.
Sourcefn resume(
&mut self,
evm: &mut Evm<'_, F::Types>,
suspended: Suspended,
carry: bool,
phase: ExecutionPhase,
)
fn resume( &mut self, evm: &mut Evm<'_, F::Types>, suspended: Suspended, carry: bool, phase: ExecutionPhase, )
Installs the active context into evm, carrying persistent accounts, logs and base warmth
over from the suspended context. With carry, the loaded and created accounts of the
suspended context are carried over as well.
Sourcefn apply_env(
&mut self,
factory: &F,
evm: &mut Evm<'_, F::Types>,
env: EvmEnv<F::Types>,
phase: ExecutionPhase,
)
fn apply_env( &mut self, factory: &F, evm: &mut Evm<'_, F::Types>, env: EvmEnv<F::Types>, phase: ExecutionPhase, )
Applies env, deferring a spec or chain ID change while a transaction is in flight.
Sourcefn store_env(&mut self, env: EvmEnv<F::Types>)
fn store_env(&mut self, env: EvmEnv<F::Types>)
Stores env as the active context’s environment.
A fork keeps the chain ID it was created or rolled with: a running change such as
vm.chainId does not follow the fork to its next selection. The executor carries such a
change to its next transaction instead.
Sourcepub const fn switch_slots(&self) -> &AddressMap<HashSet<U256>>
pub const fn switch_slots(&self) -> &AddressMap<HashSet<U256>>
Returns the warm slots of persistent accounts the last fork switch carried into the next context.
Sourcepub fn loaded_state(&self, state: &State<'_>) -> AddressMap<HashSet<U256>>
pub fn loaded_state(&self, state: &State<'_>) -> AddressMap<HashSet<U256>>
Returns the accounts loaded in the running transaction, including accounts loaded as absent and accounts loaded before fork switches, with their loaded slots.
Accepted state the running transaction did not load is not included.
Sourcepub fn loaded_storage(&self, state: &State<'_>, address: &Address) -> Vec<U256> ⓘ
pub fn loaded_storage(&self, state: &State<'_>, address: &Address) -> Vec<U256> ⓘ
Returns the slots of address loaded in the running transaction, including before fork
switches.
Sourcepub fn suspended_storage(
&self,
) -> impl Iterator<Item = (Option<U256>, Address, U256)> + '_
pub fn suspended_storage( &self, ) -> impl Iterator<Item = (Option<U256>, Address, U256)> + '_
Returns storage keys retained from earlier context visits, attributed to their forks. These can be absent from the final pending state when an unchanged slot was read before a fork switch. Collect them before parking clears the active context’s loaded keys.
Sourcepub fn sync_database_policy(&self, evm: &mut Evm<'_, F::Types>)
pub fn sync_database_policy(&self, evm: &mut Evm<'_, F::Types>)
Rebinds the running state’s backing handle to its EVM’s empty-account policy without copying accepted state or changing another execution’s policy.
Trait Implementations§
Source§impl<F: FoundryEvmFactory> Clone for ExecutionLifecycle<F>
impl<F: FoundryEvmFactory> Clone for ExecutionLifecycle<F>
Auto Trait Implementations§
impl<F> !RefUnwindSafe for ExecutionLifecycle<F>
impl<F> !UnwindSafe for ExecutionLifecycle<F>
impl<F> Freeze for ExecutionLifecycle<F>where
F: Freeze,
ForkRegistry<<F as FoundryEvmFactory>::Types>: Freeze,
StateSnapshots<LifecycleSnapshot<<F as FoundryEvmFactory>::Types>>: Freeze,
Option<EvmEnv<<F as FoundryEvmFactory>::Types>>: Freeze,
impl<F> Send for ExecutionLifecycle<F>where
ForkRegistry<<F as FoundryEvmFactory>::Types>: Send,
StateSnapshots<LifecycleSnapshot<<F as FoundryEvmFactory>::Types>>: Send,
Option<EvmEnv<<F as FoundryEvmFactory>::Types>>: Send,
impl<F> Sync for ExecutionLifecycle<F>where
ForkRegistry<<F as FoundryEvmFactory>::Types>: Sync,
StateSnapshots<LifecycleSnapshot<<F as FoundryEvmFactory>::Types>>: Sync,
Option<EvmEnv<<F as FoundryEvmFactory>::Types>>: Sync,
impl<F> Unpin for ExecutionLifecycle<F>where
F: Unpin,
ForkRegistry<<F as FoundryEvmFactory>::Types>: Unpin,
StateSnapshots<LifecycleSnapshot<<F as FoundryEvmFactory>::Types>>: Unpin,
Option<EvmEnv<<F as FoundryEvmFactory>::Types>>: Unpin,
impl<F> UnsafeUnpin for ExecutionLifecycle<F>where
F: UnsafeUnpin,
ForkRegistry<<F as FoundryEvmFactory>::Types>: UnsafeUnpin,
StateSnapshots<LifecycleSnapshot<<F as FoundryEvmFactory>::Types>>: UnsafeUnpin,
Option<EvmEnv<<F as FoundryEvmFactory>::Types>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<TxEnv, T> FromRecoveredTx<&T> for TxEnvwhere
TxEnv: FromRecoveredTx<T>,
impl<TxEnv, T> FromRecoveredTx<&T> for TxEnvwhere
TxEnv: FromRecoveredTx<T>,
§fn from_recovered_tx(tx: &&T, sender: Address) -> TxEnv
fn from_recovered_tx(tx: &&T, sender: Address) -> TxEnv
TxEnv] from a transaction and a sender address.§impl<TxEnv, T> FromTxWithEncoded<&T> for TxEnvwhere
TxEnv: FromTxWithEncoded<T>,
impl<TxEnv, T> FromTxWithEncoded<&T> for TxEnvwhere
TxEnv: FromTxWithEncoded<T>,
§fn from_encoded_tx(tx: &&T, sender: Address, encoded: Bytes) -> TxEnv
fn from_encoded_tx(tx: &&T, sender: Address, encoded: Bytes) -> TxEnv
TxEnv] from a transaction, its sender, and encoded transaction bytes.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].impl<T> MaybeCompact for T
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.§impl<T> Threaded<T> for T
impl<T> Threaded<T> for T
§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.