pub struct Dispatcher { /* private fields */ }Expand description
Tasks given to workers and their reports handled.
Implementations§
Source§impl Dispatcher
impl Dispatcher
Sourcepub const fn with_sensor_max_wait(self, max_wait: Duration) -> Self
pub const fn with_sensor_max_wait(self, max_wait: Duration) -> Self
How long a wait step without a max_wait waits.
Sourcepub const fn with_switch_off_after(self, times: u32) -> Self
pub const fn with_switch_off_after(self, times: u32) -> Self
After how many host kills in a row a wait step is switched off (0: never).
Sourcepub fn set_scheduler(&mut self, scheduler: Scheduler)
pub fn set_scheduler(&mut self, scheduler: Scheduler)
Creates the runs TriggerDagOperators start with scheduler (the core’s, sharing its
wakes), not one of its own.
Sourcepub fn set_metrics(&mut self, metrics: MasterMetrics)
pub fn set_metrics(&mut self, metrics: MasterMetrics)
Counts assignments, rejections, ended attempts, waiting tasks and finished runs in
metrics.
Sourcepub fn set_wakes(&mut self, wakes: Wakes)
pub fn set_wakes(&mut self, wakes: Wakes)
Wakes the DAGs of the runs it finishes through wakes.
Sourcepub fn memory(&self) -> Memory
pub fn memory(&self) -> Memory
A copy of what a worker’s message changes in memory (worker slots, rejections, code
missing, the cancels queued for the next step), to Self::restore if the message’s
transaction rolls back: memory then shows only what is stored (code review of 2.10b;
metrics already counted stay).
Sourcepub fn recount(&mut self)
pub fn recount(&mut self)
Drops the concurrency limits’ counts, read again from the database at the next round with tasks ready: after a commit whose answer was lost (it may have stored what the counts were changed for, or not), where neither the counts before nor after can be trusted. Put back as they were, an expiry stored would leave its attempt counted for good, its DAG’s limit holding tasks back until a restart (Codex’s review of M4.4).
Sourcepub fn undo(&mut self, memory: Memory, error: &DispatchError)
pub fn undo(&mut self, memory: Memory, error: &DispatchError)
Puts back a copy taken by Self::memory after its transaction failed; for a commit
whose answer was lost the counts are read again instead (Self::recount).
Sourcepub fn take_witnesses(&mut self) -> Vec<(String, Witness)>
pub fn take_witnesses(&mut self) -> Vec<(String, Witness)>
The attempts started or ended since the last call (see witnesses), and none from now.
Sourcepub fn restore(&mut self, memory: Memory)
pub fn restore(&mut self, memory: Memory)
Puts back a copy taken by Self::memory.
Sourcepub fn with_arrivals(self, arrivals: Arrivals) -> Self
pub fn with_arrivals(self, arrivals: Arrivals) -> Self
The dispatcher reading which attempts’ Started arrived from arrivals (the core’s, which
the streams’ readers fill), so it doesn’t take them back as never started.
Sourcepub fn with_event_lookback(self, lookback: Duration) -> Self
pub fn with_event_lookback(self, lookback: Duration) -> Self
The dispatcher reading back lookback behind an event sensor’s cursor (B185).
Sourcepub fn with_lease(self, lease: Duration) -> Self
pub fn with_lease(self, lease: Duration) -> Self
The dispatcher holding a replaced incarnation’s attempts for lease, the worker lease
(decision 443): the old process may run them that long.
Sourcepub fn with_cleanup_move_wait(self, wait: Duration) -> Self
pub fn with_cleanup_move_wait(self, wait: Duration) -> Self
The dispatcher waiting wait before a lost worker’s cleanup moves.
Sourcepub fn with_set_aside(self, set_aside: Duration, read_back: ReadBack) -> Self
pub fn with_set_aside(self, set_aside: Duration, read_back: ReadBack) -> Self
The dispatcher leaving a task whose assignment fails on its own out for set_aside,
and reading a commit cut off back as read_back says (set_aside,
read_back_window, read_back_interval).
Sourcepub const fn with_handed_call_min(self, least: Duration) -> Self
pub const fn with_handed_call_min(self, least: Duration) -> Self
The dispatcher giving an @sensor(wait_for=...)’s call at least least once it is handed
its run (see DEFAULT_HANDED_CALL_MIN).
Sourcepub const fn with_max_message_size(self, bytes: usize) -> Self
pub const fn with_max_message_size(self, bytes: usize) -> Self
The largest message a worker takes ([grpc] max_message_size).
Sourcepub fn set_notifications(&mut self, notifications: Arc<Notifications>)
pub fn set_notifications(&mut self, notifications: Arc<Notifications>)
What finished runs and tasks notify ([notifications]).
Sourcepub const fn set_max_instances(&mut self, max_instances: usize)
pub const fn set_max_instances(&mut self, max_instances: usize)
The most instances a mapped task may have ([mapping] max_instances).
Sourcepub const fn set_rounds(&mut self, rounds: RoundLimits)
pub const fn set_rounds(&mut self, rounds: RoundLimits)
How much a round does at most (decision 493), its execution’s part too.
Sourcepub fn with_code_retry_delay(self, delay: Duration) -> Self
pub fn with_code_retry_delay(self, delay: Duration) -> Self
When a task whose code wasn’t on its worker yet is tried again (see
CODE_RETRY_DELAY).
Sourcepub fn with_code_wait(self, code_wait: Duration) -> Self
pub fn with_code_wait(self, code_wait: Duration) -> Self
The dispatcher with another code wait (see DEFAULT_CODE_WAIT).
Sourcepub async fn register(
&mut self,
worker_id: &str,
incarnation: &str,
queues: &[String],
slots: u32,
now: Timestamp,
) -> Result<(), DispatchError>
pub async fn register( &mut self, worker_id: &str, incarnation: &str, queues: &[String], slots: u32, now: Timestamp, ) -> Result<(), DispatchError>
A worker registered. A new worker or a restarted one gives unschedulable tasks
another chance.
§Errors
DispatchError::Db if the database fails.
Sourcepub fn set_current_code(
&mut self,
root: &str,
accepted: &BTreeSet<String>,
version: Option<SchedrVersion>,
)
pub fn set_current_code( &mut self, root: &str, accepted: &BTreeSet<String>, version: Option<SchedrVersion>, )
A root’s accepted content hashes and its current parse’s schedr version (see
crate::discovery): its tasks go only to workers that have the root at one of those
hashes and are of at least that version.
Sourcepub fn set_connections(
&mut self,
registries: &BTreeMap<String, Arc<Registry>>,
parsed: &BTreeMap<String, String>,
)
pub fn set_connections( &mut self, registries: &BTreeMap<String, Arc<Registry>>, parsed: &BTreeMap<String, String>, )
Each root’s connections (decision 174): a task’s assignment carries those it declares.
parsed is the content hash of each root’s current parse (its registry’s).
Sourcepub fn worker_disconnected(&mut self, worker_id: &str)
pub fn worker_disconnected(&mut self, worker_id: &str)
A worker’s stream ended: no task, cleanup nor connections job goes to it until it registers again.
Sourcepub fn worker_away(&mut self, worker_id: &str)
pub fn worker_away(&mut self, worker_id: &str)
A worker a restarted master read back, not registered with it yet (see away).
Sourcepub fn connection_roots(&self) -> Vec<String>
pub fn connection_roots(&self) -> Vec<String>
The roots having connections, by name.
Sourcepub fn registry(&self, root: &str) -> Option<&Arc<Registry>>
pub fn registry(&self, root: &str) -> Option<&Arc<Registry>>
A root’s connections, if it has any.
Sourcepub fn connection_worker(
&self,
root: &str,
wanted: Option<&str>,
) -> Result<(String, String), String>
pub fn connection_worker( &self, root: &str, wanted: Option<&str>, ) -> Result<(String, String), String>
The worker a connections job of root goes to (decision 193), with the hash it has
the root at: wanted, else a connected, active worker having the root’s current code,
the one running the fewest attempts. Why none can, otherwise. The current code is the
current parse’s exactly (not newer code whose parse is on its way): its connections are
the ones the job carries.
§Errors
Why no worker can take it, for the command’s rejection.
Sourcepub fn set_worker_version(
&mut self,
worker_id: &str,
version: Option<SchedrVersion>,
)
pub fn set_worker_version( &mut self, worker_id: &str, version: Option<SchedrVersion>, )
A worker’s schedr version: it gets only tasks of parses no newer.
Sourcepub fn report_root(&mut self, worker_id: &str, root: &str, hash: &str)
pub fn report_root(&mut self, worker_id: &str, root: &str, hash: &str)
A worker reported a root’s content hash.
Sourcepub fn withdraw_root(&mut self, worker_id: &str, root: &str)
pub fn withdraw_root(&mut self, worker_id: &str, root: &str)
A worker withdrew a root (decision 303): its tasks no longer go there.
Sourcepub async fn adopt(
&mut self,
worker_id: &str,
attempt_id: &str,
now: Timestamp,
) -> Result<(), DispatchError>
pub async fn adopt( &mut self, worker_id: &str, attempt_id: &str, now: Timestamp, ) -> Result<(), DispatchError>
A reconnecting worker still runs attempt_id (or holds its result): it keeps its
slot, and the attempt counts as started, so it isn’t taken back for want of a
Started lost with the old stream (B50).
§Errors
DispatchError::Db if the database fails.
Sourcepub async fn attempt_inputs(
&self,
attempt_id: &str,
) -> Result<Option<Vec<u8>>, DispatchError>
pub async fn attempt_inputs( &self, attempt_id: &str, ) -> Result<Option<Vec<u8>>, DispatchError>
The inputs of an open attempt as JSON (see attempt_inputs).
§Errors
DispatchError::Db if the database fails.
Sourcepub fn drain(&mut self, worker_id: &str) -> Vec<Outgoing>
pub fn drain(&mut self, worker_id: &str) -> Vec<Outgoing>
A worker is drained for maintenance: it gets no new tasks, and its pokes move at once: the messages that say so.
Sourcepub fn set_drained(&mut self, worker_id: &str)
pub fn set_drained(&mut self, worker_id: &str)
A worker is drained, as it was before it registered: its pokes are moved once they are
known again (Self::drain).
Sourcepub fn is_poke(&self, worker_id: &str, attempt_id: &str) -> bool
pub fn is_poke(&self, worker_id: &str, attempt_id: &str) -> bool
Whether an attempt on a worker is a poke, which a drain moves at once.
Sourcepub fn set_watcher_slots(&mut self, worker_id: &str, slots: u32)
pub fn set_watcher_slots(&mut self, worker_id: &str, slots: u32)
A worker’s watcher slots.
Sourcepub async fn resume(
&mut self,
worker_id: &str,
now: Timestamp,
) -> Result<(), DispatchError>
pub async fn resume( &mut self, worker_id: &str, now: Timestamp, ) -> Result<(), DispatchError>
A drained worker is resumed: like a new worker, it gives unschedulable tasks
another chance.
§Errors
DispatchError::Db if the database fails.
Sourcepub async fn step(
&mut self,
now: Timestamp,
) -> Result<Vec<Outgoing>, DispatchError>
pub async fn step( &mut self, now: Timestamp, ) -> Result<Vec<Outgoing>, DispatchError>
One step of the loop: new runs get their tasks, retries whose delay passed are queued,
assignments with no Started are taken back, and ready tasks are assigned.
§Errors
DispatchError if the database fails.
Sourcepub async fn step_into(
&mut self,
now: Timestamp,
outgoing: &mut Vec<Outgoing>,
) -> Result<(), DispatchError>
pub async fn step_into( &mut self, now: Timestamp, outgoing: &mut Vec<Outgoing>, ) -> Result<(), DispatchError>
As Self::step, into outgoing: the assignments made before a failure are there
still (each stored before its message is built, B7).
§Errors
DispatchError if the database fails.
Sourcepub async fn prepare(
&mut self,
now: Timestamp,
outgoing: &mut Vec<Outgoing>,
) -> Result<(), DispatchError>
pub async fn prepare( &mut self, now: Timestamp, outgoing: &mut Vec<Outgoing>, ) -> Result<(), DispatchError>
A round’s first part of the dispatcher’s: runs prepared, due retries queued.
§Errors
DispatchError if the database fails.
Sourcepub async fn expire_round(
&mut self,
now: Timestamp,
) -> Result<(), DispatchError>
pub async fn expire_round( &mut self, now: Timestamp, ) -> Result<(), DispatchError>
A round’s part: assignments past their worker’s echo expired, replaced incarnations’ attempts ended.
§Errors
DispatchError if the database fails.
Sourcepub async fn assign_round(
&mut self,
now: Timestamp,
outgoing: &mut Vec<Outgoing>,
) -> Result<(), DispatchError>
pub async fn assign_round( &mut self, now: Timestamp, outgoing: &mut Vec<Outgoing>, ) -> Result<(), DispatchError>
A round’s assignments (Self::assign_into), the mapped lists read afresh: a worker’s
turn may have run since the round’s last part (decision 469).
§Errors
DispatchError if the database fails.
Sourcepub async fn assign_into(
&mut self,
now: Timestamp,
outgoing: &mut Vec<Outgoing>,
) -> Result<(), DispatchError>
pub async fn assign_into( &mut self, now: Timestamp, outgoing: &mut Vec<Outgoing>, ) -> Result<(), DispatchError>
As Self::assign, into outgoing: all of the step’s assignments, or, after a failure,
none (nothing of them stored either).
§Errors
DispatchError if the database fails.
Sourcepub async fn started(
&mut self,
worker_id: &str,
started: &Started,
now: Timestamp,
) -> Result<Option<Outgoing>, DispatchError>
pub async fn started( &mut self, worker_id: &str, started: &Started, now: Timestamp, ) -> Result<Option<Outgoing>, DispatchError>
A worker reported Started. Returns a CancelAttempt if the attempt was taken back,
ended or belongs to another worker.
§Errors
DispatchError::Db if the database fails.
Sourcepub async fn started_group(
&mut self,
worker_id: &str,
group: &[Started],
now: Timestamp,
) -> Result<Vec<Outgoing>, DispatchError>
pub async fn started_group( &mut self, worker_id: &str, group: &[Started], now: Timestamp, ) -> Result<Vec<Outgoing>, DispatchError>
A turn’s Starteds together (M5.1d), as Self::started handles each: the attempts
read in one query, their starts recorded in a statement for each start method. One that
isn’t this worker’s, or is no longer running, is answered with a cancel.
§Errors
DispatchError::Db if the database fails: the caller’s transaction rolls back, and
the messages are handled one by one.
Sourcepub fn set_steady(&mut self, steady: Steady)
pub fn set_steady(&mut self, steady: Steady)
Times this dispatcher on steady (see crate::clock).
Sourcepub fn set_wall(&mut self, wall: fn() -> Timestamp)
pub fn set_wall(&mut self, wall: fn() -> Timestamp)
Reads the wall clock from wall where it is compared with master time (M5.1m).
Sourcepub async fn rejected(
&mut self,
worker_id: &str,
rejected: &Rejected,
now: Timestamp,
) -> Result<(), DispatchError>
pub async fn rejected( &mut self, worker_id: &str, rejected: &Rejected, now: Timestamp, ) -> Result<(), DispatchError>
A worker rejected an assignment.
§Errors
DispatchError::BadMessage for an unknown reason, or DispatchError::Db.
Sourcepub async fn task_ended(
&mut self,
worker_id: &str,
result: &Finished,
now: Timestamp,
) -> Result<(), DispatchError>
pub async fn task_ended( &mut self, worker_id: &str, result: &Finished, now: Timestamp, ) -> Result<(), DispatchError>
A worker’s task ended and its cleanup starts: the instance is cleaning_up, its
attempt open until Finished, and the task’s result kept, for a worker lost meanwhile
(decision 229). Only from the worker it was assigned to (B46).
§Errors
DispatchError if the database fails.
Sourcepub async fn finished(
&mut self,
worker_id: &str,
finished: &Finished,
now: Timestamp,
) -> Result<Outgoing, DispatchError>
pub async fn finished( &mut self, worker_id: &str, finished: &Finished, now: Timestamp, ) -> Result<Outgoing, DispatchError>
A worker reported Finished: stored once (only from the worker the attempt was assigned
to, B46), and always acknowledged.
§Errors
DispatchError::BadMessage for an unknown status, or a database failure.
Sourcepub async fn finished_group(
&mut self,
worker_id: &str,
group: &[Finished],
now: Timestamp,
) -> Result<Vec<Outgoing>, DispatchError>
pub async fn finished_group( &mut self, worker_id: &str, group: &[Finished], now: Timestamp, ) -> Result<Vec<Outgoing>, DispatchError>
A turn’s Finisheds together (M4B.4, B184): the attempts read in one query, the
common case (the worker’s own attempt, not moved, its first result) ended in one
statement, its outputs in another, each run read and moved forward once. Any other
(a moved cleanup’s, a rest, another worker’s, code gone missing, a repeat) goes through
Self::finished alone, first. Each is acknowledged.
§Errors
DispatchError if a message is malformed or the database fails: the caller’s
transaction rolls back, and the messages are handled one by one.
Sourcepub async fn expire(&mut self, now: Timestamp) -> Result<usize, DispatchError>
pub async fn expire(&mut self, now: Timestamp) -> Result<usize, DispatchError>
Takes back assignments the worker’s echo shows it never started (B240): a message from
it named the assignment’s number as handled, with no Started (or Finished) before.
They end assignment_expired and their tasks run again without using a retry; a moved
cleanup never started goes on waiting for another worker. One not known unstarted
stays: its worker hasn’t handled it yet (it does, in order), or its lease runs out
(Self::worker_lost decides), or it registers again (its journal decides,
Self::unreported_unstarted). Returns how many attempts ended.
§Errors
DispatchError if the database fails.
Sourcepub async fn incarnation_replaced(
&mut self,
worker_id: &str,
reported: &BTreeSet<&str>,
now: Timestamp,
) -> Result<usize, DispatchError>
pub async fn incarnation_replaced( &mut self, worker_id: &str, reported: &BTreeSet<&str>, now: Timestamp, ) -> Result<usize, DispatchError>
A worker’s agent restarted (a new incarnation), before its stream replaces the old
one’s: the attempts the old process may run and the new one doesn’t report are marked,
and end lost with a WorkerRestarted error summary once the old incarnation’s lease
is over in master time (decision 443, B230: the old process may still run them
meanwhile; see Self::end_replaced), each using a retry, as for a lost worker (the
crash may have been the task’s own; see archive/PROJECT.md, Worker lifecycle). Those
are the started ones, and the unstarted ones the old stream’s echo doesn’t show it
never started (B240: its Started may have been lost with its stream). Those it shows
never started are taken back now, without using a retry; a moved cleanup among them
waits for another worker. Returns how many were marked.
§Errors
DispatchError if the database fails.
Sourcepub async fn unreported_unstarted(
&mut self,
worker_id: &str,
reported: &BTreeSet<&str>,
now: Timestamp,
) -> Result<usize, DispatchError>
pub async fn unreported_unstarted( &mut self, worker_id: &str, reported: &BTreeSet<&str>, now: Timestamp, ) -> Result<usize, DispatchError>
The same process registered again (a stream broken, the worker running on): its journal holds every assignment it accepted, so one not started and not in it never started there, and is taken back now (B240; what its old stream still carries, it drops). Returns how many.
§Errors
DispatchError if the database fails.
Sourcepub async fn reported(
&mut self,
worker_id: &str,
attempt_ids: &[String],
) -> Result<(), DispatchError>
pub async fn reported( &mut self, worker_id: &str, attempt_ids: &[String], ) -> Result<(), DispatchError>
The attempts worker_id’s journal reports at its registration: alive there, none of
its own is held for a replaced incarnation any more (Grok’s review of decision 443: one
told to continue was still ended when the hold ran out). Another worker’s, which its
journal can’t keep, stays held.
§Errors
DispatchError if the database fails.
Sourcepub async fn end_replaced(
&mut self,
now: Timestamp,
) -> Result<usize, DispatchError>
pub async fn end_replaced( &mut self, now: Timestamp, ) -> Result<usize, DispatchError>
Ends lost the attempts a replaced incarnation left behind whose lease is over in master
time (decision 443), each whole or not at all; a kept result the database refuses is
dropped, as for a lost worker. Returns how many ended.
§Errors
DispatchError if the database fails.
Sourcepub async fn worker_lost(
&mut self,
worker_id: &str,
results: KeptResults,
now: Timestamp,
) -> Result<(), DispatchError>
pub async fn worker_lost( &mut self, worker_id: &str, results: KeptResults, now: Timestamp, ) -> Result<(), DispatchError>
A worker is lost or gone: its started attempts end lost with a WorkerLost error
summary (each uses a retry), the ones it never started assignment_expired with a
WorkerLeft one (queued again, no retry), and it is forgotten.
§Errors
DispatchError if the database fails.
Sourcepub async fn handles_added(
&mut self,
worker_id: &str,
added: &HandlesAdded,
) -> Result<(), DispatchError>
pub async fn handles_added( &mut self, worker_id: &str, added: &HandlesAdded, ) -> Result<(), DispatchError>
Handles an attempt registered, kept for a cleanup on another worker (decision 242). Only from the worker it is assigned to (B46), while it is open, and up to what an attempt may hold (decision 228); a handle that doesn’t read is left out.
§Errors
DispatchError if the database fails.
Sourcepub async fn cancel_task(
&mut self,
run_id: &str,
__arg2: (&TaskId, Option<i32>),
now: Timestamp,
) -> Result<(TaskCancel, Vec<Outgoing>), DispatchError>
pub async fn cancel_task( &mut self, run_id: &str, __arg2: (&TaskId, Option<i32>), now: Timestamp, ) -> Result<(TaskCancel, Vec<Outgoing>), DispatchError>
Cancels one task of a run (see Execution::cancel_task); a CancelAttempt for its
attempt if it runs.
§Errors
DispatchError for an unknown run or task, or a database failure.
Sourcepub async fn retry_task(
&mut self,
run_id: &str,
__arg2: (&TaskId, Option<i32>),
now: Timestamp,
) -> Result<TaskRetry, DispatchError>
pub async fn retry_task( &mut self, run_id: &str, __arg2: (&TaskId, Option<i32>), now: Timestamp, ) -> Result<TaskRetry, DispatchError>
Queues an unschedulable task of an unfinished run again (see
Execution::retry_task), forgetting which workers rejected it (schedr tasks retry).
§Errors
DispatchError for an unknown run or task, or a database failure.
Sourcepub async fn cancel_run(
&mut self,
run_id: &str,
now: Timestamp,
) -> Result<Vec<Outgoing>, DispatchError>
pub async fn cancel_run( &mut self, run_id: &str, now: Timestamp, ) -> Result<Vec<Outgoing>, DispatchError>
Cancels a run; returns a CancelAttempt for each of its running attempts.
§Errors
DispatchError for an unknown run or a database failure.
Sourcepub fn place_trigger(
&mut self,
active: &ActiveDag,
instance: &str,
(after, failures): (Option<String>, u32),
now: Timestamp,
) -> Option<(Outgoing, String)>
pub fn place_trigger( &mut self, active: &ActiveDag, instance: &str, (after, failures): (Option<String>, u32), now: Timestamp, ) -> Option<(Outgoing, String)>
The worker to run a DAG’s trigger: as a wait step’s, on a watcher slot, which it takes.
Gives the assignment and the code it was picked for; None when no worker has a free one,
or the root’s current code isn’t known yet (a parse on its way after a restart).
Sourcepub fn worker(&self, id: &str) -> Option<&Worker>
pub fn worker(&self, id: &str) -> Option<&Worker>
A worker: what the trigger pass asks of the one running a trigger.
Sourcepub fn trigger_kept(&mut self, worker: &str, instance: &str, now: Timestamp)
pub fn trigger_kept(&mut self, worker: &str, instance: &str, now: Timestamp)
A trigger keeps its watcher slot on the worker that came back with it.
Sourcepub fn trigger_released(&mut self, instance: &str)
pub fn trigger_released(&mut self, instance: &str)
A trigger gave up its watcher slot: the trigger loop looks (another may start there).
Sourcepub fn trigger_wake(&self) -> Arc<Notify> ⓘ
pub fn trigger_wake(&self) -> Arc<Notify> ⓘ
What the trigger loop waits on besides writes: told when a trigger’s state changes in memory only.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Dispatcher
impl !UnwindSafe for Dispatcher
impl Freeze for Dispatcher
impl Send for Dispatcher
impl Sync for Dispatcher
impl Unpin for Dispatcher
impl UnsafeUnpin for Dispatcher
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> 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> 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);