struct FunctionRunner<'a, FEN: FoundryEvmNetwork> {
tcfg: Cow<'a, TestRunnerConfig<FEN>>,
executor: Cow<'a, Executor<FEN>>,
cr: &'a ContractRunner<'a, FEN>,
address: Address,
setup: &'a TestSetup,
result: TestResult,
}Expand description
Executes a single test function, returning a TestResult.
Fields§
§tcfg: Cow<'a, TestRunnerConfig<FEN>>The function-level configuration.
executor: Cow<'a, Executor<FEN>>The EVM executor.
cr: &'a ContractRunner<'a, FEN>The parent runner.
address: AddressThe address of the test contract.
setup: &'a TestSetupThe test setup result.
result: TestResultThe test result. Returned after running the test.
Implementations§
Source§impl<'a, FEN: FoundryEvmNetwork> FunctionRunner<'a, FEN>
impl<'a, FEN: FoundryEvmNetwork> FunctionRunner<'a, FEN>
fn new(cr: &'a ContractRunner<'a, FEN>, setup: &'a TestSetup) -> Self
const fn revert_decoder(&self) -> &'a RevertDecoder
Sourcefn fuzz_progress(
&self,
test_name: &str,
timeout: Option<u32>,
runs: u32,
) -> Option<ProgressBar>
fn fuzz_progress( &self, test_name: &str, timeout: Option<u32>, runs: u32, ) -> Option<ProgressBar>
Creates the progress bar for a fuzz or invariant campaign, if progress is shown.
fn fuzz_minimize_target_id(&self, test_name: &str) -> String
Sourcefn symbolic_artifact(
&self,
test_name: &str,
kind: SymbolicCounterexampleArtifactKind,
symbolic: &SymbolicResult,
fail_on_revert: bool,
calls: Vec<SymbolicCounterexampleCall>,
) -> SymbolicCounterexampleArtifact
fn symbolic_artifact( &self, test_name: &str, kind: SymbolicCounterexampleArtifactKind, symbolic: &SymbolicResult, fail_on_revert: bool, calls: Vec<SymbolicCounterexampleCall>, ) -> SymbolicCounterexampleArtifact
Builds a symbolic counterexample artifact for this test.
Sourcefn write_symbolic_artifact(
&self,
file_name: &str,
artifact: &SymbolicCounterexampleArtifact,
) -> Option<SymbolicArtifactRef>
fn write_symbolic_artifact( &self, file_name: &str, artifact: &SymbolicCounterexampleArtifact, ) -> Option<SymbolicArtifactRef>
Writes artifact to the stable per-test path, so the latest counterexample replaces
older ones, and returns a reference to it.
Sourcefn persist_sequence_artifact(
&self,
test_name: &str,
file_name: &str,
calls: Vec<SymbolicCounterexampleCall>,
fail_on_revert: bool,
storage: &[SymbolicStorageAssignment],
failure: Option<SymbolicInvariantArtifactFailure>,
) -> Option<SymbolicArtifactRef>
fn persist_sequence_artifact( &self, test_name: &str, file_name: &str, calls: Vec<SymbolicCounterexampleCall>, fail_on_revert: bool, storage: &[SymbolicStorageAssignment], failure: Option<SymbolicInvariantArtifactFailure>, ) -> Option<SymbolicArtifactRef>
Persists a replay-confirmed stateful counterexample as a sequence artifact.
Sourcefn sequence_calls(
&self,
call_sequence: &[BaseCounterExample],
) -> Vec<SymbolicCounterexampleCall>
fn sequence_calls( &self, call_sequence: &[BaseCounterExample], ) -> Vec<SymbolicCounterexampleCall>
Converts a counterexample sequence into artifact calls.
Sourcefn replay_confirmed_symbolic_single_call(
&self,
call: &SymbolicCounterexampleCall,
expected_reason: Option<&str>,
) -> Result<(RawCallResult<FEN>, Option<String>), String>
fn replay_confirmed_symbolic_single_call( &self, call: &SymbolicCounterexampleCall, expected_reason: Option<&str>, ) -> Result<(RawCallResult<FEN>, Option<String>), String>
Replays a single-call minimization candidate and checks it fails for expected_reason.
Sourcefn replay_invariant_error_sequence(
&mut self,
replay: SequenceReplay<'_>,
original_calls: &[BasicTxDetails],
inner_sequence: Option<Vec<Option<BasicTxDetails>>>,
identified_contracts: &ContractsByAddress,
current_settings: &InvariantSettings,
artifact: SequenceArtifactSpec<'_>,
progress: Option<&ProgressBar>,
position: Option<(usize, usize)>,
) -> Result<ReplayedInvariantSequence>
fn replay_invariant_error_sequence( &mut self, replay: SequenceReplay<'_>, original_calls: &[BasicTxDetails], inner_sequence: Option<Vec<Option<BasicTxDetails>>>, identified_contracts: &ContractsByAddress, current_settings: &InvariantSettings, artifact: SequenceArtifactSpec<'_>, progress: Option<&ProgressBar>, position: Option<(usize, usize)>, ) -> Result<ReplayedInvariantSequence>
Shrinks and replays a failing invariant call sequence, persisting the confirmed counterexample as a symbolic artifact.
Sourcefn replay_error(
&mut self,
config: InvariantConfig,
executor: Executor<FEN>,
calls: &[BasicTxDetails],
inner_sequence: Option<Vec<Option<BasicTxDetails>>>,
expect_assertion_failure: bool,
target_value: Option<I256>,
invariant_contract: &InvariantContract<'_>,
target_invariant: &Function,
identified_contracts: &ContractsByAddress,
progress: Option<&ProgressBar>,
position: Option<(usize, usize)>,
) -> Result<ReplayErrorResult>
fn replay_error( &mut self, config: InvariantConfig, executor: Executor<FEN>, calls: &[BasicTxDetails], inner_sequence: Option<Vec<Option<BasicTxDetails>>>, expect_assertion_failure: bool, target_value: Option<I256>, invariant_contract: &InvariantContract<'_>, target_invariant: &Function, identified_contracts: &ContractsByAddress, progress: Option<&ProgressBar>, position: Option<(usize, usize)>, ) -> Result<ReplayErrorResult>
Shrinks and replays a failing call sequence, collecting logs, traces and coverage into the test result. Returns the counterexample, the terminal check outcome when shrinking re-checked the sequence, and the fork block number.
fn minimize_symbolic_invariant_sequence( &self, replay: SequenceReplay<'_>, calls: &[BasicTxDetails], identified_contracts: &ContractsByAddress, current_settings: &InvariantSettings, ) -> Option<MinimizedSequence>
fn symbolic_sequence_sender_candidates( &self, current_settings: &InvariantSettings, ) -> Vec<Address>
Sourcefn symbolic_sequence_failure(
&self,
replay: SequenceReplay<'_>,
calls: &[SymbolicCounterexampleCall],
) -> Option<CheckSequenceOutcome>
fn symbolic_sequence_failure( &self, replay: SequenceReplay<'_>, calls: &[SymbolicCounterexampleCall], ) -> Option<CheckSequenceOutcome>
Replays calls concretely and returns the outcome if the sequence still fails.
Sourcefn replay_persisted_call_sequence(
&self,
invariant_contract: &InvariantContract<'_>,
call_sequence: &mut [BaseCounterExample],
expect_assertion_failure: bool,
storage: &[SymbolicStorageAssignment],
) -> Result<(Vec<BasicTxDetails>, CheckSequenceOutcome)>
fn replay_persisted_call_sequence( &self, invariant_contract: &InvariantContract<'_>, call_sequence: &mut [BaseCounterExample], expect_assertion_failure: bool, storage: &[SymbolicStorageAssignment], ) -> Result<(Vec<BasicTxDetails>, CheckSequenceOutcome)>
Converts a persisted counterexample into transactions (applying show_solidity in
place) and replays it through check_sequence.
Sourcefn replay_persisted_handler_failures(
&self,
handlers_dir: &Path,
current_settings: &InvariantSettings,
) -> (HashMap<(Address, Selector), InvariantFuzzError>, HashMap<(Address, Selector, B256), SymbolicHandlerReplayStorage>)
fn replay_persisted_handler_failures( &self, handlers_dir: &Path, current_settings: &InvariantSettings, ) -> (HashMap<(Address, Selector), InvariantFuzzError>, HashMap<(Address, Selector, B256), SymbolicHandlerReplayStorage>)
Replays persisted handler-side assertion bugs. A file is kept only if the anchor still
asserts at the same (reverter, selector) site; stale files (anchor no longer asserts,
asserts at a different site, or earlier call asserts) are deleted in place.
Sourcefn apply_function_inline_config(&mut self, func: &Function) -> Result<()>
fn apply_function_inline_config(&mut self, func: &Function) -> Result<()>
Configures this runner with the inline configuration for the contract.
fn run( self, func: &Function, invariants: &[&Function], shared_invariant_namespace: bool, kind: TestFunctionKind, call_after_invariant: bool, identified_contracts: Option<&ContractsByAddress>, ) -> TestResult
Sourcefn run_unit_test(self, func: &Function) -> TestResult
fn run_unit_test(self, func: &Function) -> TestResult
Runs a single unit test.
Applies before test txes (if any), runs current test and returns the TestResult.
Before test txes are applied in order and state modifications committed to the EVM database
(therefore the unit test call will be made on modified state).
State modifications of before test txes and unit test function call are discarded after
test ends, similar to eth_call.
Sourcefn call_test(
&mut self,
func: &Function,
args: &[DynSolValue],
) -> Result<(RawCallResult<FEN>, Option<String>), ()>
fn call_test( &mut self, func: &Function, args: &[DynSolValue], ) -> Result<(RawCallResult<FEN>, Option<String>), ()>
Calls func on the test contract, returning the raw result and revert reason. Skipped
and failed calls are recorded in the test result and returned as Err.
Sourcefn symbolic_run_input<'f>(
&'f self,
func: &'f Function,
sender: Address,
collect_success_input: bool,
corpus_seeds: Vec<SymbolicConcreteInput>,
branch_target: Option<SymbolicBranchTarget>,
) -> SymbolicRunInput<'f, FEN>
fn symbolic_run_input<'f>( &'f self, func: &'f Function, sender: Address, collect_success_input: bool, corpus_seeds: Vec<SymbolicConcreteInput>, branch_target: Option<SymbolicBranchTarget>, ) -> SymbolicRunInput<'f, FEN>
Builds the symbolic executor input for one run of func.
Sourcefn fuzz_test_paths<'f>(
&self,
func: &'f Function,
fuzz_config: &mut FuzzConfig,
) -> (Cow<'f, str>, Option<PathBuf>, (PathBuf, PathBuf))
fn fuzz_test_paths<'f>( &self, func: &'f Function, fuzz_config: &mut FuzzConfig, ) -> (Cow<'f, str>, Option<PathBuf>, (PathBuf, PathBuf))
Sets the per-test corpus directory in fuzz_config and returns the test path name, the
legacy corpus directory and the persisted failure (dir, file) paths.
Sourcefn import_symbolic_fuzz_corpus(
&self,
func: &Function,
) -> (Vec<SymbolicConcreteInput>, Option<SymbolicCorpusSeedMetadata>)
fn import_symbolic_fuzz_corpus( &self, func: &Function, ) -> (Vec<SymbolicConcreteInput>, Option<SymbolicCorpusSeedMetadata>)
Imports persisted fuzz corpus entries as symbolic path-priority hints.
Sourcefn import_symbolic_fuzz_frontiers(
&self,
func: &Function,
fuzz_config: &FuzzConfig,
) -> Vec<(u64, Address, SymbolicBranchTarget, SymbolicConcreteInput)>
fn import_symbolic_fuzz_frontiers( &self, func: &Function, fuzz_config: &FuzzConfig, ) -> Vec<(u64, Address, SymbolicBranchTarget, SymbolicConcreteInput)>
Imports persisted fuzz branch frontiers as (id, sender, branch target, input) seeds.
fn import_symbolic_invariant_frontiers( &self, invariant_contract: &InvariantContract<'_>, invariant_config: &InvariantConfig, ) -> Vec<(FuzzBranchFrontierRecord, Arc<[BasicTxDetails]>)>
fn symbolic_corpus_seed_input( &self, func: &Function, tx_seq: &[BasicTxDetails], ) -> Option<SymbolicConcreteInput>
Sourcefn run_symbolic_test(self, func: &Function) -> TestResult
fn run_symbolic_test(self, func: &Function) -> TestResult
Runs a symbolic test and replays any discovered counterexample concretely.
Sourcefn replay_symbolic_counterexample(
&mut self,
func: &Function,
args: Vec<DynSolValue>,
calldata: Bytes,
stats: SymbolicStats,
symbolic_config: &SymbolicConfig,
) -> (TestStatus, Option<String>, Option<CounterExample>, SymbolicResult)
fn replay_symbolic_counterexample( &mut self, func: &Function, args: Vec<DynSolValue>, calldata: Bytes, stats: SymbolicStats, symbolic_config: &SymbolicConfig, ) -> (TestStatus, Option<String>, Option<CounterExample>, SymbolicResult)
Replays a symbolic counterexample concretely, minimizing and persisting it when it reproduces.
Sourcefn run_symbolic_artifact_replay(
self,
func: &Function,
invariants: &[&Function],
call_after_invariant: bool,
) -> TestResult
fn run_symbolic_artifact_replay( self, func: &Function, invariants: &[&Function], call_after_invariant: bool, ) -> TestResult
Replays a durable symbolic counterexample artifact against this freshly set up test.
Sourcefn replay_symbolic_artifact(
&mut self,
func: &Function,
invariants: &[&Function],
call_after_invariant: bool,
) -> Result<(), String>
fn replay_symbolic_artifact( &mut self, func: &Function, invariants: &[&Function], call_after_invariant: bool, ) -> Result<(), String>
Replays a persisted symbolic counterexample artifact against func, failing with the
mismatch reason when the recorded outcome does not reproduce.
fn try_seed_fuzz_corpus_from_frontiers( &self, func: &Function, fuzz_config: &FuzzConfig, )
fn invariant_sequence_failure_site( &self, invariant_contract: &InvariantContract<'_>, invariant_idx: usize, sequence: &[BasicTxDetails], replay_order: &[usize], call_after_invariant: bool, ) -> Option<CheckSequenceFailureSite>
fn solve_invariants_from_frontier_prefix( &self, invariant_contract: &InvariantContract<'_>, invariant_indexes: &[usize], prefix_executor: &Executor<FEN>, target: &SymbolicInvariantTarget, sender: Address, prefix: &[BasicTxDetails], ) -> Vec<(usize, CheckSequenceFailureSite, Vec<BasicTxDetails>)>
fn try_seed_invariant_corpus_from_frontiers( &self, invariant_contract: &InvariantContract<'_>, invariant_config: &InvariantConfig, sender_filters: &SenderFilters, targeted_contracts: &FuzzRunIdentifiedContracts, dynamic_target_ctx: &DynamicTargetCtx<'_>, )
fn try_seed_fuzz_corpus_symbolically( &self, func: &Function, fuzz_config: &FuzzConfig, )
Sourcefn persist_symbolic_fuzz_seed(
&self,
corpus: &FuzzCorpusConfig,
sender: Address,
calldata: Bytes,
) -> Result<Option<PathBuf>>
fn persist_symbolic_fuzz_seed( &self, corpus: &FuzzCorpusConfig, sender: Address, calldata: Bytes, ) -> Result<Option<PathBuf>>
Persists a concretely confirmed symbolic input as a fuzz corpus seed.
Sourcefn symbolic_fuzz_seed_replay(
&self,
sender: Address,
input: &SymbolicConcreteInput,
fuzz_config: &FuzzConfig,
) -> Option<bool>
fn symbolic_fuzz_seed_replay( &self, sender: Address, input: &SymbolicConcreteInput, fuzz_config: &FuzzConfig, ) -> Option<bool>
Replays a symbolic seed concretely: Some(success), or None if the input was rejected.
Sourcefn run_table_test(self, func: &Function) -> TestResult
fn run_table_test(self, func: &Function) -> TestResult
Runs a table test. The parameters dataset (table) is created from defined parameter fixtures, therefore each test table parameter should have the same number of fixtures defined. E.g. for table test
table_test(uint256 amount, bool swap)fixtures are defined asuint256[] public fixtureAmount = [2, 5]bool[] public fixtureSwap = [true, false]Thetable_testis then called with the pair of args(2, true)and(5, false).
fn run_invariant_test( self, func: &Function, invariants: Vec<(&Function, bool)>, shared_invariant_namespace: bool, call_after_invariant: bool, identified_contracts: &ContractsByAddress, ) -> TestResult
Sourcefn sort_predicate_results(
&self,
results: impl Iterator<Item = InvariantPredicateResult>,
) -> Vec<InvariantPredicateResult>
fn sort_predicate_results( &self, results: impl Iterator<Item = InvariantPredicateResult>, ) -> Vec<InvariantPredicateResult>
Orders predicate results by their declaration position in the test contract ABI.
fn invariant_skip_reason(&self, func: &Function) -> Option<SkipReason>
Sourcefn run_fuzz_test(self, func: &Function) -> TestResult
fn run_fuzz_test(self, func: &Function) -> TestResult
Runs a fuzzed test.
Applies the before test txes (if any), fuzzes the current function and returns the
TestResult.
Before test txes are applied in order and state modifications committed to the EVM database
(therefore the fuzz test will use the modified state).
State modifications of before test txes and fuzz test are discarded after test ends,
similar to eth_call.
fn prepare_test(&mut self, func: &Function) -> Result<(), ()>
fn fuzz_runner(&self) -> TestRunner
Sourcefn run_showmap(
self,
func: &Function,
test_name: &str,
corpus_dir: Option<PathBuf>,
showmap: &ShowmapConfig,
target: ShowmapReplayTarget<'_>,
) -> TestResult
fn run_showmap( self, func: &Function, test_name: &str, corpus_dir: Option<PathBuf>, showmap: &ShowmapConfig, target: ShowmapReplayTarget<'_>, ) -> TestResult
Replays the persisted corpus and writes AFL-afl-showmap-style files.
fn invariant_runner(&self) -> TestRunner
fn clone_executor(&self) -> Executor<FEN>
fn clone_executor_with_symbolic_storage( &self, storage: &[SymbolicStorageAssignment], ) -> Result<Executor<FEN>>
fn build_fuzz_state( &self, invariant: bool, func: Option<&Function>, ) -> EvmFuzzState
fn build_fuzz_state_uncached( &self, invariant: bool, config: FuzzDictionaryConfig, ) -> EvmFuzzState
Trait Implementations§
Source§impl<'a, FEN: FoundryEvmNetwork> Deref for FunctionRunner<'a, FEN>
impl<'a, FEN: FoundryEvmNetwork> Deref for FunctionRunner<'a, FEN>
Auto Trait Implementations§
impl<'a, FEN> !Freeze for FunctionRunner<'a, FEN>
impl<'a, FEN> !RefUnwindSafe for FunctionRunner<'a, FEN>
impl<'a, FEN> !UnwindSafe for FunctionRunner<'a, FEN>
impl<'a, FEN> Send for FunctionRunner<'a, FEN>where
Cow<'a, TestRunnerConfig<FEN>>: Send,
Cow<'a, Executor<FEN>>: Send,
&'a ContractRunner<'a, FEN>: Send,
impl<'a, FEN> Sync for FunctionRunner<'a, FEN>where
Cow<'a, TestRunnerConfig<FEN>>: Sync,
Cow<'a, Executor<FEN>>: Sync,
&'a ContractRunner<'a, FEN>: Sync,
impl<'a, FEN> Unpin for FunctionRunner<'a, FEN>where
Cow<'a, TestRunnerConfig<FEN>>: Unpin,
Cow<'a, Executor<FEN>>: Unpin,
&'a ContractRunner<'a, FEN>: Unpin,
impl<'a, FEN> UnsafeUnpin for FunctionRunner<'a, FEN>where
Cow<'a, TestRunnerConfig<FEN>>: UnsafeUnpin,
Cow<'a, Executor<FEN>>: UnsafeUnpin,
&'a ContractRunner<'a, FEN>: 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
§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> ErasedDestructor for Twhere
T: 'static,
§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<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<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§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.