pub struct Client<T> { /* private fields */ }Expand description
Typed calls to the API.
Implementations§
Source§impl<T: Transport> Client<T>
impl<T: Transport> Client<T>
Sourcepub const fn new(transport: T, poll: Duration, timeout: Duration) -> Self
pub const fn new(transport: T, poll: Duration, timeout: Duration) -> Self
A client over transport, waiting for decisions every poll for at most timeout.
Sourcepub const fn poll(&self) -> Duration
pub const fn poll(&self) -> Duration
How often it reads again while waiting (a decision, a growing log).
Sourcepub async fn workers(&self) -> Result<WorkerList, ClientError>
pub async fn workers(&self) -> Result<WorkerList, ClientError>
Sourcepub async fn triggers(&self) -> Result<TriggerList, ClientError>
pub async fn triggers(&self) -> Result<TriggerList, ClientError>
GET /api/v1/triggers: every DAG’s trigger.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn dag_trigger(&self, dag: &str) -> Result<TriggerView, ClientError>
pub async fn dag_trigger(&self, dag: &str) -> Result<TriggerView, ClientError>
GET /api/v1/dags/{dag}/trigger: a DAG’s trigger.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn trigger_events(
&self,
dag: &str,
limit: u32,
) -> Result<EventList, ClientError>
pub async fn trigger_events( &self, dag: &str, limit: u32, ) -> Result<EventList, ClientError>
GET /api/v1/dags/{dag}/trigger/events: what it found, newest first.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn post_event(
&self,
event: &PostEventRequest,
) -> Result<NamedEventView, ClientError>
pub async fn post_event( &self, event: &PostEventRequest, ) -> Result<NamedEventView, ClientError>
POST /api/v1/events: posts an event (decision 354), sent under the current command key
when with_command_key set one (so Client::submit can send it again safely).
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn named_events(
&self,
name: Option<&str>,
limit: u32,
) -> Result<NamedEventList, ClientError>
pub async fn named_events( &self, name: Option<&str>, limit: u32, ) -> Result<NamedEventList, ClientError>
GET /api/v1/events: the newest events posted, of name if given, at most limit.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn restart_trigger(
&self,
dag: &str,
) -> Result<CommandView, ClientError>
pub async fn restart_trigger( &self, dag: &str, ) -> Result<CommandView, ClientError>
POST /api/v1/dags/{dag}/trigger/restart: the command.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn skip_trigger_run(
&self,
dag: &str,
) -> Result<CommandView, ClientError>
pub async fn skip_trigger_run( &self, dag: &str, ) -> Result<CommandView, ClientError>
POST /api/v1/dags/{dag}/trigger/skip: the command.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn switch_on_trigger(
&self,
dag: &str,
) -> Result<CommandView, ClientError>
pub async fn switch_on_trigger( &self, dag: &str, ) -> Result<CommandView, ClientError>
POST /api/v1/dags/{dag}/trigger/switch-on: the command.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn switched_off_sensors(&self) -> Result<SensorList, ClientError>
pub async fn switched_off_sensors(&self) -> Result<SensorList, ClientError>
GET /api/v1/sensors/switched-off: the wait steps switched off.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn switch_on_sensor(
&self,
dag: &str,
sensor: &str,
) -> Result<CommandView, ClientError>
pub async fn switch_on_sensor( &self, dag: &str, sensor: &str, ) -> Result<CommandView, ClientError>
POST /api/v1/dags/{dag}/sensors/{sensor}/switch-on: the command.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn run_resources(
&self,
run: &str,
) -> Result<ResourceList, ClientError>
pub async fn run_resources( &self, run: &str, ) -> Result<ResourceList, ClientError>
GET /api/v1/runs/{run}/resources: a run’s resources.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn deployment(&self) -> Result<DeploymentView, ClientError>
pub async fn deployment(&self) -> Result<DeploymentView, ClientError>
GET /api/v1/deployment: the deployment’s nodes and their configurations (masked).
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn samples(
&self,
range: &str,
process: Option<&str>,
) -> Result<SampleSeriesList, ClientError>
pub async fn samples( &self, range: &str, process: Option<&str>, ) -> Result<SampleSeriesList, ClientError>
GET /api/v1/metrics/samples: each process’s samples over range (1h, 24h, 7d,
30d), or one process’s.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn task_flow(&self, range: &str) -> Result<TaskFlowList, ClientError>
pub async fn task_flow(&self, range: &str) -> Result<TaskFlowList, ClientError>
GET /api/v1/metrics/tasks: the attempts over range in buckets: how many ended, by
how, and the start latency of those started (decision 494).
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn memory_totals(
&self,
range: &str,
) -> Result<MemoryTotals, ClientError>
pub async fn memory_totals( &self, range: &str, ) -> Result<MemoryTotals, ClientError>
GET /api/v1/metrics/memory: every process’s memory together over range.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn task_memory(
&self,
dag: &str,
task: &str,
) -> Result<AttemptMemoryList, ClientError>
pub async fn task_memory( &self, dag: &str, task: &str, ) -> Result<AttemptMemoryList, ClientError>
GET /api/v1/dags/{dag}/tasks/{task}/memory: the task’s last attempts’ peak memory.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn dag_memory(&self, dag: &str) -> Result<DagMemoryList, ClientError>
pub async fn dag_memory(&self, dag: &str) -> Result<DagMemoryList, ClientError>
GET /api/v1/dags/{dag}/memory: each task’s p95 peak memory against its limit.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn import_errors(&self) -> Result<ImportErrorList, ClientError>
pub async fn import_errors(&self) -> Result<ImportErrorList, ClientError>
Sourcepub async fn connections(&self) -> Result<ConnectionList, ClientError>
pub async fn connections(&self) -> Result<ConnectionList, ClientError>
GET /api/v1/connections: each root’s connections and the tasks declaring them.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn dags(&self) -> Result<DagList, ClientError>
pub async fn dags(&self) -> Result<DagList, ClientError>
Sourcepub async fn dag(&self, dag: &str) -> Result<DagView, ClientError>
pub async fn dag(&self, dag: &str) -> Result<DagView, ClientError>
GET /api/v1/dags/{dag}.
§Errors
ClientError if the request fails (a DAG that doesn’t exist: the server’s 404) or
the answer doesn’t read.
Sourcepub async fn runs(
&self,
dag: &str,
planned_for: Option<Timestamp>,
) -> Result<RunList, ClientError>
pub async fn runs( &self, dag: &str, planned_for: Option<Timestamp>, ) -> Result<RunList, ClientError>
GET /api/v1/dags/{dag}/runs, optionally for one moment.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn all_runs(
&self,
query: &AllRunsQuery,
) -> Result<RunList, ClientError>
pub async fn all_runs( &self, query: &AllRunsQuery, ) -> Result<RunList, ClientError>
GET /api/v1/runs?dag=...&state=...&before=...&before_run=...&limit=...: runs of every DAG (or one),
newest triggered first.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn run_dag(&self, run_id: &str) -> Result<Value, ClientError>
pub async fn run_dag(&self, run_id: &str) -> Result<Value, ClientError>
GET /api/v1/runs/{run}/dag: the DAG JSON of the version the run ran with.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn run_commands(
&self,
run_id: &str,
) -> Result<CommandList, ClientError>
pub async fn run_commands( &self, run_id: &str, ) -> Result<CommandList, ClientError>
GET /api/v1/runs/{run}/commands.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn output(
&self,
run_id: &str,
task_id: &str,
) -> Result<OutputView, ClientError>
pub async fn output( &self, run_id: &str, task_id: &str, ) -> Result<OutputView, ClientError>
GET /api/v1/runs/{run}/tasks/{task}/output (an error with status 404 while it has
none).
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn instance_output(
&self,
run_id: &str,
task_id: &str,
map_index: Option<u32>,
) -> Result<OutputView, ClientError>
pub async fn instance_output( &self, run_id: &str, task_id: &str, map_index: Option<u32>, ) -> Result<OutputView, ClientError>
As Self::output, of one instance of a mapped task (None: a mapped task’s whole
list, decision 81).
§Errors
As Self::output.
Sourcepub async fn events(&self) -> Result<EventReader, ClientError>
pub async fn events(&self) -> Result<EventReader, ClientError>
GET /api/v1/changes: what changed, as it happens (run, dag, workers and
refresh events).
§Errors
ClientError if the stream can’t be opened.
Sourcepub async fn command(
&self,
command_id: &str,
) -> Result<CommandView, ClientError>
pub async fn command( &self, command_id: &str, ) -> Result<CommandView, ClientError>
GET /api/v1/commands/{command}: a command and the master’s decision.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn attempts(
&self,
run_id: &str,
task_id: &str,
) -> Result<AttemptList, ClientError>
pub async fn attempts( &self, run_id: &str, task_id: &str, ) -> Result<AttemptList, ClientError>
GET /api/v1/runs/{run}/tasks/{task}/attempts.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn instance_attempts(
&self,
run_id: &str,
task_id: &str,
map_index: Option<u32>,
) -> Result<AttemptList, ClientError>
pub async fn instance_attempts( &self, run_id: &str, task_id: &str, map_index: Option<u32>, ) -> Result<AttemptList, ClientError>
Sourcepub async fn log(
&self,
run_id: &str,
task_id: &str,
try_number: u32,
from: u64,
) -> Result<LogChunk, ClientError>
pub async fn log( &self, run_id: &str, task_id: &str, try_number: u32, from: u64, ) -> Result<LogChunk, ClientError>
GET /api/v1/runs/{run}/tasks/{task}/attempts/{try}/log?from=....
§Errors
ClientError if the request fails (the worker is gone, the log deleted) or the
answer doesn’t read.
Sourcepub async fn log_part(
&self,
run_id: &str,
task_id: &str,
try_number: u32,
from: u64,
limit: u64,
) -> Result<LogChunk, ClientError>
pub async fn log_part( &self, run_id: &str, task_id: &str, try_number: u32, from: u64, limit: u64, ) -> Result<LogChunk, ClientError>
Sourcepub async fn instance_log_part(
&self,
run_id: &str,
__arg2: (&str, Option<u32>),
try_number: u32,
from: u64,
limit: u64,
) -> Result<LogChunk, ClientError>
pub async fn instance_log_part( &self, run_id: &str, __arg2: (&str, Option<u32>), try_number: u32, from: u64, limit: u64, ) -> Result<LogChunk, ClientError>
Sourcepub async fn set_paused(
&self,
dag: &str,
paused: bool,
cancel_runs: bool,
) -> Result<CommandView, ClientError>
pub async fn set_paused( &self, dag: &str, paused: bool, cancel_runs: bool, ) -> Result<CommandView, ClientError>
POST /api/v1/dags/{dag}/pause or .../unpause: the command.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn trigger(
&self,
dag: &str,
planned_for: Option<Timestamp>,
params: Option<&Map<String, Value>>,
) -> Result<CommandView, ClientError>
pub async fn trigger( &self, dag: &str, planned_for: Option<Timestamp>, params: Option<&Map<String, Value>>, ) -> Result<CommandView, ClientError>
POST /api/v1/dags/{dag}/runs: the command; params, values for the run’s
parameters over the DAG’s defaults.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn trigger_with(
&self,
dag: &str,
request: &TriggerRequest,
) -> Result<CommandView, ClientError>
pub async fn trigger_with( &self, dag: &str, request: &TriggerRequest, ) -> Result<CommandView, ClientError>
POST /api/v1/dags/{dag}/runs: the command, for a run asked for in full.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn backfill(
&self,
dag: &str,
request: &BackfillRequest,
) -> Result<CommandView, ClientError>
pub async fn backfill( &self, dag: &str, request: &BackfillRequest, ) -> Result<CommandView, ClientError>
POST /api/v1/dags/{dag}/backfills: the command (schedr runs backfill).
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn dag_backfills(
&self,
dag: &str,
) -> Result<BackfillList, ClientError>
pub async fn dag_backfills( &self, dag: &str, ) -> Result<BackfillList, ClientError>
GET /api/v1/dags/{dag}/backfills: its newest backfills.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn get_backfill(
&self,
backfill_id: &str,
) -> Result<BackfillView, ClientError>
pub async fn get_backfill( &self, backfill_id: &str, ) -> Result<BackfillView, ClientError>
GET /api/v1/backfills/{backfill}.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn cancel_backfill(
&self,
backfill_id: &str,
) -> Result<CommandView, ClientError>
pub async fn cancel_backfill( &self, backfill_id: &str, ) -> Result<CommandView, ClientError>
POST /api/v1/backfills/{backfill}/cancel: the command (schedr runs cancel --backfill).
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn check_connections(
&self,
request: &CheckConnectionsRequest,
) -> Result<CommandView, ClientError>
pub async fn check_connections( &self, request: &CheckConnectionsRequest, ) -> Result<CommandView, ClientError>
POST /api/v1/connections/check: the command (schedr connections check).
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn test_connection(
&self,
name: &str,
request: &TestConnectionRequest,
) -> Result<CommandView, ClientError>
pub async fn test_connection( &self, name: &str, request: &TestConnectionRequest, ) -> Result<CommandView, ClientError>
POST /api/v1/connections/{name}/test: the command (schedr connections test).
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn wait_connections(
&self,
command: CommandView,
timeout: Duration,
) -> Result<ConnectionsResult, ClientError>
pub async fn wait_connections( &self, command: CommandView, timeout: Duration, ) -> Result<ConnectionsResult, ClientError>
Reads an applied connections command back until every job has its answer (or was
lost), for at most timeout: its result.
§Errors
ClientError::Timeout if a worker hasn’t answered by then, a result that doesn’t
read (ClientError::Unexpected), or a request failure.
Sourcepub async fn cancel(&self, run_id: &str) -> Result<CommandView, ClientError>
pub async fn cancel(&self, run_id: &str) -> Result<CommandView, ClientError>
POST /api/v1/runs/{run}/cancel: the command.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn task_action(
&self,
run_id: &str,
__arg2: (&str, Option<u32>),
action: TaskAction,
) -> Result<CommandView, ClientError>
pub async fn task_action( &self, run_id: &str, __arg2: (&str, Option<u32>), action: TaskAction, ) -> Result<CommandView, ClientError>
POST /api/v1/runs/{run}/tasks/{task}/{action} (cancel or retry): the command.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn worker_action(
&self,
worker_id: &str,
action: WorkerAction,
) -> Result<CommandView, ClientError>
pub async fn worker_action( &self, worker_id: &str, action: WorkerAction, ) -> Result<CommandView, ClientError>
POST /api/v1/workers/{worker}/{action} (drain or resume): the command.
§Errors
ClientError if the request fails or the answer doesn’t read.
Sourcepub async fn send_command<F>(
&self,
request: impl Fn() -> F,
) -> Result<CommandView, ClientError>
pub async fn send_command<F>( &self, request: impl Fn() -> F, ) -> Result<CommandView, ClientError>
Self::submit under a new key: one command, stored once however often it is sent
(boxed: its future stays small in the caller’s). For one-shot callers (the CLI), whose
key is gone once they return.
§Errors
As Self::submit, but ClientError::Unanswered when no answer came: the command
may have arrived.
Sourcepub async fn submit<R, F>(
&self,
key: String,
request: impl Fn() -> F,
) -> Result<R, ClientError>
pub async fn submit<R, F>( &self, key: String, request: impl Fn() -> F, ) -> Result<R, ClientError>
Sends a command with request, stored once (B140): under key (the client’s
Idempotency-Key; new_command_key for a new one), and sent again with the same key,
at most COMMAND_TRIES times in all, while no answer comes or the server fails (it may
have stored it): the webserver gives the command stored the first time.
§Errors
The last try’s ClientError, or the first that isn’t worth another try (the server
refused the command).
Sourcepub async fn wait(
&self,
command: CommandView,
) -> Result<CommandView, ClientError>
pub async fn wait( &self, command: CommandView, ) -> Result<CommandView, ClientError>
Reads command back until the master decides it.
§Errors
ClientError::Rejected with the master’s reason, ClientError::Timeout if it
stays pending, or a request failure.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Client<T>where
T: Freeze,
impl<T> RefUnwindSafe for Client<T>where
T: RefUnwindSafe,
impl<T> Send for Client<T>where
T: Send,
impl<T> Sync for Client<T>where
T: Sync,
impl<T> Unpin for Client<T>where
T: Unpin,
impl<T> UnsafeUnpin for Client<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Client<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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);