Skip to main content

NoopTool

Struct NoopTool 

Source
pub struct NoopTool;
Expand description

The concrete empty subtool supported by this first typed snapshot domain. A tool that only injects the syscall it receives.

Trait Implementations§

Source§

impl Debug for NoopTool

Source§

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

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

impl Default for NoopTool

Source§

fn default() -> NoopTool

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

impl<'de> Deserialize<'de> for NoopTool

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for NoopTool

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Tool for NoopTool

Source§

type GlobalState = GlobalState

The type of the global half that goes along with this Local tool. By including this type, the Tool is actually a complete specification for an instrumentation tool.
Source§

type ThreadState = ()

Tool-state specific to each guest thread. If unset, this defaults to the unit type (), indicating that the tool does not have thread-level state. Read more
Source§

fn stream_role() -> ToolStreamRole

Pure static role of this Tool’s stream, independent of Config booleans.
Source§

fn native_mm_ownership(_cfg: &Config) -> NativeMmOwnership

Declare native executor ownership for Tool code running in the observed address space. See [NativeMmOwnership] for the complete obligation. Read more
Source§

fn subscriptions(_cfg: &Config) -> Subscription

Events the tool subscribes to. This is only called once for the entire tree. By default, all syscalls are traced (but CPUID/RDTSC instructions are not).
Source§

fn handle_syscall_event<'life0, 'life1, 'async_trait, T>( &'life0 self, guest: &'life1 mut T, call: Syscall, ) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>
where T: 'async_trait + Guest<Self>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The tool receives an event from the guest, via the Reverie program instrumentation. A Reverie syscall handler fires in the moment before a guest syscall executes (like a “prehook”). Read more
§

fn new(_pid: Pid, _cfg: &<Self::GlobalState as GlobalTool>::Config) -> Self

A common constructor that initializes state when a process is created, including the guest’s initial, root process. Of course, every process includes at least one thread, but the process level state is allocated before thread level-state for the process’s main thread is allocated. Read more
§

fn observes_native_syscalls( _cfg: &<Self::GlobalState as GlobalTool>::Config, ) -> bool

Pure opt-in to synchronous final-native-call observations. The default performs no additional native queries or descriptor pinning.
§

fn observe_native_syscall( &self, _state: &Self::ThreadState, _facts: &dyn NativeSyscallFacts, _call: &NativeSyscallCall, ) -> Result<Option<Arc<dyn NativeSyscallObserver>>, Error>

Observe an actual request after all guest-capable preparation and before native issue. The provider cannot inject, resume or await. Returned cookies are retained by the backend, independently of callback lifetime.
§

fn facility_admission( _cfg: &<Self::GlobalState as GlobalTool>::Config, ) -> Result<(), Error>

Operational facility admission before global initialization or launch. Backends call this explicitly; subscription queries must remain pure.
§

fn reserved_input_requirement( _cfg: &<Self::GlobalState as GlobalTool>::Config, ) -> Option<ReservedInputRequirement>

Pure request for one fixed private input page, or no mapping at all. Backends additionally require serialized execution before enabling it.
§

fn thread_ownership( _cfg: &<Self::GlobalState as GlobalTool>::Config, ) -> ThreadOwnership

How this tool’s guest threads (children created via CLONE_THREAD) are owned. See [ThreadOwnership]. Called once per tree, like [Tool::subscriptions]. Read more
§

fn init_thread_state( &self, _child: Pid, _parent: Option<(Pid, &Self::ThreadState)>, ) -> Self::ThreadState

A guest process creates additional threads, which need their tool state initialized. This method returns a newly-allocated thread state. This method necessarily runs before the first instruction of a newly created guest thread. Read more
§

fn on_initial_image_attached( &self, _tid: Pid, _thread_state: &mut Self::ThreadState, ) -> Result<(), Error>

Bind a fresh root state to an initial image whose launch exec has already completed before this Tool’s first registration. Read more
§

fn handle_thread_start<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

Similar to handle_syscall_event, except this traps the first instruction executed by a new thread. Typical uses of this method include delaying thread execution or running initialization actions (injections or rpcs). Read more
§

fn on_thread_state_ready( &self, _tid: Pid, _global_state: &Self::GlobalState, _thread_state: &Self::ThreadState, ) -> Result<(), Error>

Observe this backend’s actual thread state after a successful handle_thread_start or handle_post_exec, before ordinary guest execution resumes. The ptrace backend supplies this synchronous hook; other backends must implement an equivalent owned lifecycle boundary before relying on it. The default performs no work. Read more
§

fn handle_post_exec<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, ) -> Pin<Box<dyn Future<Output = Result<(), Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

Called upon a successful execve. In handle_syscall_event, after injecting execve, it is not possible to run code after a successful execve because it never returns. Read more
§

fn handle_exec_commit<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, ) -> Pin<Box<dyn Future<Output = Result<(), Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

Called once an execve or execveat this Tool injected can no longer fail, on a backend that carries the exec out itself rather than through a host kernel exec (today the KVM backend). The backend has finished every step that could fail: it has read the path, the argument strings and the environment strings out of guest memory and validated the new image. The old image’s memory is still this guest’s, and the image is replaced only after this returns; handle_post_exec then follows in the new image, and the injection does not return. This is the point Linux’s begin_new_exec reaches past point_of_no_return, where exec_mmap runs exec_mm_release on the old address space (fs/exec.c), after do_execveat_common has copied the strings. A Tool that models what Linux does to the old image there, such as the robust-futex walk futex_exec_release makes, does it here, where the strings the new image receives can no longer change. Read more
§

fn handle_cpuid_event<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, eax: u32, ecx: u32, ) -> Pin<Box<dyn Future<Output = Result<CpuIdResult, Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

CPUID is trapped, the tool should implement this function to return [eax, ebx, ecx, edx]. Read more
§

fn handle_rdtsc_event<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, request: Rdtsc, ) -> Pin<Box<dyn Future<Output = Result<RdtscResult, Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

rdtsc/rdtscp is trapped, the tool should implement this function to return the counter. Read more
§

fn handle_signal_event<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, signal: Signal, ) -> Pin<Box<dyn Future<Output = Result<Option<Signal>, Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

Handles a guest’s signal before it is delivered to guest. Read more
§

fn handle_raw_signal_event<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, signal: i32, ) -> Pin<Box<dyn Future<Output = Result<Option<i32>, Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

Handles a guest’s signal that [Signal] cannot name before it is delivered to the guest: a realtime signal, numbered 32 to 64 (glibc reserves 32 and 33, so SIGRTMIN() is 34). signal is the raw number. A backend reports every other signal to [Tool::handle_signal_event] (https://github.com/rrnewton/reverie/issues/207). Read more
§

fn announce_signal_event<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, signal: i32, ) -> Pin<Box<dyn Future<Output = Result<Option<SignalAnnouncement>, Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

The first half of a signal delivery reported in two phases, by a backend that knows of a delivery before the kernel dequeues the signal: an in-guest backend predicts the deliveries the kernel will make when its runtime returns to guest code. signal is the raw number, 1 to 64; any other is EINVAL. Read more
§

fn commit_signal_event<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, _announcement: SignalAnnouncement, ) -> Pin<Box<dyn Future<Output = Result<(), Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

The second half of a two-phase delivery ([Tool::announce_signal_event]): the backend’s final read confirmed that the kernel delivers the announced signal when the runtime returns to guest code, and the Tool records the delivery. It must not wait for a turn in its schedule, and cannot suppress or replace the signal; an Err ends the run. The default refuses with EOPNOTSUPP.
§

fn withdraw_signal_event( &self, _thread_state: &mut Self::ThreadState, _announcement: SignalAnnouncement, )

Settles an announcement ([Tool::announce_signal_event]) whose delivery does not happen at the runtime’s return: another signal pushed it out. The signal stays pending in the kernel, to be announced again at a later return. It can only record: it gets the thread’s state and no access to the guest. The default records nothing.
§

fn exit_for_predicted_death<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, _status: ExitStatus, ) -> Pin<Box<dyn Future<Output = Result<(), Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

Called once, after the commits of a final read that predicts the thread group’s death at the runtime’s return ([Tool::announce_signal_event], step 3): the last committed delivery is default-fatal, and status names the signal it dies of ([crate::PredictionEnd::Death]). status is not a wait status and must not be forwarded as one: its core flag is always false, because whether a core is written is known only when the kernel has tried (whether the default action asks for one is [crate::PredictedAction::Fatal]’s core_dump); the wait status a parent sees comes from the kernel at the reap. The backend has already withdrawn every announcement behind that delivery. Read more
§

fn filter_unreported_signal<'life0, 'life1, 'async_trait, R>( &'life0 self, _rpc: &'life1 R, _signal: UnreportedSignal, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, R: 'async_trait + GlobalRPC<Self::GlobalState>, Self: 'async_trait,

Decides whether a signal that the backend passes to the guest without reporting it to [Tool::handle_signal_event] reaches the guest at all. Read more
§

fn observes_sigreturns( _config: &<Self::GlobalState as GlobalTool>::Config, ) -> bool

Whether this Tool wants every guest rt_sigreturn reported to [Tool::handle_sigreturn], known from configuration alone. A backend whose capabilities say it reports sigreturns (BackendCapabilities::reports_sigreturns) then reports each one, except those the capability names; the ptrace backend stops at each guest rt_sigreturn only for such a Tool, and not while its gdbserver is attached. The default wants none, so a backend adds no stop.
§

fn in_guest_signal_delivery( _config: &<Self::GlobalState as GlobalTool>::Config, ) -> bool

Whether this Tool, known from configuration alone, takes an in-guest backend’s own signal delivery: while its runtime runs, the runtime blocks every signal it does not reserve, and at each return to guest code it predicts the kernel’s deliveries ([crate::predict_deliveries]), reports them in two phases ([Tool::announce_signal_event]), and makes a predicted death a scheduled one ([Tool::exit_for_predicted_death]). Such a backend reads it once, when its runtime starts in a process, and keeps its existing delivery when it does not hold. Read more
§

fn enforces_serialized_execution( _config: &<Self::GlobalState as GlobalTool>::Config, ) -> bool

Whether this Tool, known from configuration alone, enforces a serialized-execution contract: Read more
§

fn handle_sigreturn( &self, _thread_state: &mut Self::ThreadState, _report: SigreturnReport, )

Records one guest rt_sigreturn before it runs, for a Tool for which [Tool::observes_sigreturns] holds, on a backend that reports sigreturns. The backend then carries the call out exactly as it would without the hook. Read more
§

fn note_unreported_signal( &self, _thread_state: &mut Self::ThreadState, _signal: &UnreportedSignal, _kept: bool, )

Records, in the taking thread’s state, one signal the backend passes on unreported, after [Tool::filter_unreported_signal] decided about it: kept is that hook’s answer. A kept signal is resumed into the guest, and Linux then delivers it, puts it back in the queue when the thread’s mask blocks it (a later stop can take the same instance again and pass it once more), queues a new instance with a kernel siginfo (a syscall stop), or discards it (an ignored signal, or a ptrace event stop or group stop); a dropped one is not resumed. So the hook sees passes, not deliveries. The signal’s [crate::UnreportedSignal::reason] says why it was not reported, so that a Tool can count what its signal callback never saw. Read more
§

fn may_observe_signal_dequeues( _config: &<Self::GlobalState as GlobalTool>::Config, ) -> bool

Admits acknowledgment of real KVM pending removals before thread start. Other Tools retain their existing pending-state behavior by default. Read more
§

fn requires_signal_control( _config: &<Self::GlobalState as GlobalTool>::Config, ) -> bool

Whether this run cannot proceed without process signal control, known from configuration alone. Read more
§

fn handle_signal_dequeue<'life0, 'life1, 'async_trait, G>( &'life0 self, _guest: &'life1 mut G, _dequeue: SignalDequeue, ) -> Pin<Box<dyn Future<Output = Result<(), Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, G: 'async_trait + Guest<Self>, Self: 'async_trait,

Acknowledges one irreversible pending removal before any later Tool/guest work. The backend retains the journal entry until this returns success. An error is terminal; it is never a rollback or an ordinary guest syscall errno. Notifications are process-wide FIFO, but each runs on its removing Guest. Another owner can wait here before posting its next Tool scheduler request. An opted-in Tool must complete this acknowledgment without requiring that waiting owner to make progress or relinquish its scheduler token. FIFO sequencing alone does not establish deterministic event membership.
§

fn handle_structured_signal_event<'life0, 'life1, 'async_trait, T>( &'life0 self, guest: &'life1 mut T, event: SignalEvent, ) -> Pin<Box<dyn Future<Output = Result<Option<SignalEvent>, Errno>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

Handles a structured guest signal immediately before a virtual backend delivers it. Read more
§

fn handle_timer_event<'life0, 'life1, 'async_trait, T>( &'life0 self, _guest: &'life1 mut T, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait + Guest<Self>, Self: 'async_trait,

Handles a timer event generated by a call to Guest::set_timer
§

fn on_exit_thread<'life0, 'life1, 'async_trait, G>( &'life0 self, _tid: Pid, _global_state: &'life1 G, _thread_state: Self::ThreadState, _exit_status: ExitStatus, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, G: 'async_trait + GlobalRPC<Self::GlobalState>, Self: 'async_trait,

Called when a thread will exit shortly or has exited. That means there will be no more intercepted events on this thread. Read more
§

fn on_exit_process<'life0, 'async_trait, G>( self, _pid: Pid, _global_state: &'life0 G, _exit_status: ExitStatus, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, G: 'async_trait + GlobalRPC<Self::GlobalState>, Self: 'async_trait,

Called when a process will exit shortly or has exited. That means there will be no more intercepted events on from any thread within this process. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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.

§

impl<T> Paint for T
where T: ?Sized,

§

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 primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Primary].

§Example
println!("{}", value.primary());
§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Fixed].

§Example
println!("{}", value.fixed(color));
§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Rgb].

§Example
println!("{}", value.rgb(r, g, b));
§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Black].

§Example
println!("{}", value.black());
§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Red].

§Example
println!("{}", value.red());
§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Green].

§Example
println!("{}", value.green());
§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Yellow].

§Example
println!("{}", value.yellow());
§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Blue].

§Example
println!("{}", value.blue());
§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Magenta].

§Example
println!("{}", value.magenta());
§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Cyan].

§Example
println!("{}", value.cyan());
§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: White].

§Example
println!("{}", value.white());
§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlack].

§Example
println!("{}", value.bright_black());
§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightRed].

§Example
println!("{}", value.bright_red());
§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightGreen].

§Example
println!("{}", value.bright_green());
§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightYellow].

§Example
println!("{}", value.bright_yellow());
§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlue].

§Example
println!("{}", value.bright_blue());
§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.bright_magenta());
§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightCyan].

§Example
println!("{}", value.bright_cyan());
§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightWhite].

§Example
println!("{}", value.bright_white());
§

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>

Returns self with the bg() set to [Color :: Primary].

§Example
println!("{}", value.on_primary());
§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Fixed].

§Example
println!("{}", value.on_fixed(color));
§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Rgb].

§Example
println!("{}", value.on_rgb(r, g, b));
§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Black].

§Example
println!("{}", value.on_black());
§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Red].

§Example
println!("{}", value.on_red());
§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Green].

§Example
println!("{}", value.on_green());
§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Yellow].

§Example
println!("{}", value.on_yellow());
§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Blue].

§Example
println!("{}", value.on_blue());
§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Magenta].

§Example
println!("{}", value.on_magenta());
§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Cyan].

§Example
println!("{}", value.on_cyan());
§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: White].

§Example
println!("{}", value.on_white());
§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlack].

§Example
println!("{}", value.on_bright_black());
§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightRed].

§Example
println!("{}", value.on_bright_red());
§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightGreen].

§Example
println!("{}", value.on_bright_green());
§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightYellow].

§Example
println!("{}", value.on_bright_yellow());
§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlue].

§Example
println!("{}", value.on_bright_blue());
§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.on_bright_magenta());
§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightCyan].

§Example
println!("{}", value.on_bright_cyan());
§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightWhite].

§Example
println!("{}", value.on_bright_white());
§

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 bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Bold].

§Example
println!("{}", value.bold());
§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Dim].

§Example
println!("{}", value.dim());
§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Italic].

§Example
println!("{}", value.italic());
§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Underline].

§Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute :: Blink].

§Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute :: RapidBlink].

§Example
println!("{}", value.rapid_blink());
§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Invert].

§Example
println!("{}", value.invert());
§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Conceal].

§Example
println!("{}", value.conceal());
§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Strike].

§Example
println!("{}", value.strike());
§

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 mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Mask].

§Example
println!("{}", value.mask());
§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Wrap].

§Example
println!("{}", value.wrap());
§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Linger].

§Example
println!("{}", value.linger());
§

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.

Returns self with the quirk() set to [Quirk :: Clear].

§Example
println!("{}", value.clear());
§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Resetting].

§Example
println!("{}", value.resetting());
§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Bright].

§Example
println!("{}", value.bright());
§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: OnBright].

§Example
println!("{}", value.on_bright());
§

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);
§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new [Painted] with a default [Style]. Read more
§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows 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) -> R
where R: 'a,

Mutably borrows 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
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> RecordOrReplay for T
where T: Tool<GlobalState = GlobalState>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

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

Source§

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

Source§

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<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more