Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

A configured Tracker client.

Implementations§

Source§

impl Client

Source

pub fn new(config: &ClientConfig) -> Result<Self, ApiError>

Source

pub async fn myself(&self) -> Result<User, ApiError>

GET /v3/myself — the cheapest call that proves the whole chain works: token, organisation header, and network.

Source

pub async fn issue(&self, key: &str) -> Result<(Issue, Value), ApiError>

One issue, both normalised and raw.

The raw payload travels alongside so that --json-raw does not cost a second request, and so that a field we do not model is still reachable.

The links of an issue, with their direction resolved.

Tracker keeps links on their own endpoint, so the compact issue view costs two requests. Showing links is worth that: “what blocks this” is the question that follows “what is this”, and making the caller ask twice costs more than one round trip (ADR 3).

GET /v3/issues/{key}/remotelinks — the links that leave Tracker.

Its own request rather than a second section of Self::issue_links: most issues have none, and making every issue links pay for a request that usually answers [] is the wrong trade.

Source

pub async fn search( &self, query: &str, page: u32, per_page: u32, ) -> Result<Page<Issue>, ApiError>

One page of search results.

Tracker reports the total in X-Total-Count. When it does not, the page still has to be honest about whether more exists, which is why Page::has_more falls back to “a full page probably is not the last”.

Source

pub async fn count(&self, query: &str) -> Result<u64, ApiError>

How many issues match, without fetching any of them.

Source

pub async fn create_issue(&self, body: &Value) -> Result<Issue, ApiError>

POST /v3/issues/ — create an issue, returning it normalised.

Source

pub async fn update_issue( &self, key: &str, body: &Value, ) -> Result<Issue, ApiError>

PATCH /v3/issues/{key} — change fields.

Source

pub async fn add_comment( &self, key: &str, text: &str, ) -> Result<Comment, ApiError>

POST /v3/issues/{key}/comments — add a comment.

Source

pub async fn update_comment( &self, key: &str, id: &str, text: &str, ) -> Result<Comment, ApiError>

Rewrite a comment that is already there.

Tracker keeps no history of the previous text and shows the comment as edited, so this replaces rather than appends: the old wording is gone.

Source

pub async fn delete_comment(&self, key: &str, id: &str) -> Result<(), ApiError>

Remove a comment.

Source

pub async fn update_worklog( &self, key: &str, id: &str, body: &Value, ) -> Result<Worklog, ApiError>

Correct a worklog entry that is already recorded.

Source

pub async fn worklogs(&self, key: &str) -> Result<Vec<Worklog>, ApiError>

GET /v3/issues/{key}/worklog — every entry, oldest first.

Source

pub async fn add_worklog( &self, key: &str, body: &Value, ) -> Result<Worklog, ApiError>

POST /v3/issues/{key}/worklog — record time spent.

Source

pub async fn delete_worklog(&self, key: &str, id: &str) -> Result<(), ApiError>

DELETE /v3/issues/{key}/worklog/{id}.

Source

pub async fn checklist(&self, key: &str) -> Result<Vec<ChecklistItem>, ApiError>

GET /v3/issues/{key}/checklistItems.

Source

pub async fn add_checklist_item( &self, key: &str, body: &Value, ) -> Result<Vec<ChecklistItem>, ApiError>

POST /v3/issues/{key}/checklistItems — add a line.

Tracker answers with the whole issue rather than the item, so the list comes back out of the issue’s own checklistItems.

Source

pub async fn update_checklist_item( &self, key: &str, id: &str, body: &Value, ) -> Result<Vec<ChecklistItem>, ApiError>

PATCH /v3/issues/{key}/checklistItems/{id} — tick, untick or reword.

Source

pub async fn delete_checklist_item( &self, key: &str, id: &str, ) -> Result<(), ApiError>

DELETE /v3/issues/{key}/checklistItems/{id}.

POST /v3/issues/{key}/links — link two issues.

DELETE /v3/issues/{key}/links/{id}.

Source

pub async fn transitions(&self, key: &str) -> Result<Vec<Transition>, ApiError>

Transitions available from the issue’s current status.

Source

pub async fn execute_transition( &self, key: &str, transition: &str, body: &Value, ) -> Result<(), ApiError>

Perform a transition.

Source

pub async fn entities( &self, kind: &str, input: Option<&str>, page: u32, per_page: u32, ) -> Result<Page<Entity>, ApiError>

Search projects, portfolios or goals.

The entity endpoints answer with their own envelope (values, hits, pages) rather than the header-based totals the issue endpoints use, so the page is assembled from the body here.

Source

pub async fn entities_in( &self, parent: &str, page: u32, per_page: u32, ) -> Result<Page<Entity>, ApiError>

What a portfolio contains: the portfolios and projects under it.

Two requests, because the entity endpoints are typed and containment is not: a portfolio holds both. The tally sums the two totals, so shown N of M is the real count even though a page is a page of each.

Source

pub async fn entity(&self, kind: &str, id: &str) -> Result<Entity, ApiError>

One project, portfolio or goal, by the id the entity endpoints use.

Source

pub async fn attachments(&self, key: &str) -> Result<Vec<Attachment>, ApiError>

The attachments of an issue.

Source

pub async fn download(&self, url: &str) -> Result<Vec<u8>, ApiError>

Download an attachment’s bytes.

The download URL comes out of the payload, which means it is supplied by the server rather than chosen by us. It is checked against the configured API host before being followed: a crafted content URL must not be able to send this client, carrying its OAuth header, to somewhere else.

Source

pub async fn upload( &self, key: &str, filename: &str, bytes: Vec<u8>, ) -> Result<Attachment, ApiError>

Upload a file to an issue.

Source

pub async fn queues(&self) -> Result<Vec<Queue>, ApiError>

Queues visible to the active profile.

Tracker paginates this endpoint; the ceiling is deliberately generous because “how many queues can I see” is a question with a small answer, and a second page here would be surprising.

Worklog entries across the whole organisation.

createdBy takes a login or a uid and not me: Tracker reads it as a login and answers 422 saying no such user exists. Resolving me is the caller’s job, with one extra request to myself.

Source

pub async fn move_issue( &self, key: &str, queue: &str, keep_fields: bool, initial_status: bool, ) -> Result<Issue, ApiError>

Move an issue to another queue.

The issue keeps its identity and loses its name: PROJ-42 becomes OTHER-17, and there is no request that undoes it. Tracker drops fields the target queue does not define unless moveAllFields says otherwise, so that choice is the caller’s rather than a default we picked for them.

Source

pub async fn changelog( &self, key: &str, per_page: u32, ) -> Result<Vec<Change>, ApiError>

What changed on an issue, newest last.

Tracker pages this with an opaque cursor rather than page numbers, and the cursor is only worth spending when somebody asks for more than the first page — which nobody has yet. So this asks for one page, and the caller says how big.

Source

pub async fn queue_versions(&self, key: &str) -> Result<Vec<Version>, ApiError>

The versions a queue defines.

This is what an issue’s fixVersions refers to; without it that field is an id with no meaning.

Source

pub async fn queue_tags(&self, key: &str) -> Result<Vec<String>, ApiError>

The tags in use in a queue.

Source

pub async fn queue_automation(&self, key: &str) -> Result<Automation, ApiError>

Everything that changes issues in a queue on its own.

Three requests, and a refusal of one of them is an answer rather than a failure: triggers need queue-owner rights, so a member of the queue gets two sections and Tracker’s own words about the third. All three failing is a different thing — a queue that is not there, or a token that is not allowed — and is reported as the error it is.

Source

pub async fn dictionary( &self, kind: Dictionary, ) -> Result<Vec<DictEntry>, ApiError>

One of the four organisation-wide dictionaries.

Small and unpaged — the largest of the four is statuses, in the dozens — so this asks for the whole thing and says nothing about pages.

Source

pub async fn users( &self, page: u32, per_page: u32, ) -> Result<Page<Person>, ApiError>

One page of the organisation’s directory.

Paged, unlike the dictionaries: an organisation has as many people in it as it has people, and the one this was written against already answers with a three-figure total.

Source

pub async fn user(&self, who: &str) -> Result<Person, ApiError>

One person, by login or by uid.

There is no users/me: Tracker answers 404 for it, and myself is the endpoint that question belongs to.

Source

pub async fn boards(&self) -> Result<Vec<Board>, ApiError>

Boards visible to the active profile.

Not paginated by the endpoint, and not by us: an organisation has boards in the dozens, not the thousands.

Source

pub async fn board(&self, id: &str) -> Result<Board, ApiError>

One board.

Source

pub async fn sprints(&self, board: &str) -> Result<Vec<Sprint>, ApiError>

The sprints of a board.

A board that cannot have sprints answers with a refusal rather than an empty list, and that refusal is passed through as Tracker worded it: a kanban board having no sprints is Tracker’s answer to the question, not a failure of the command, and inventing an empty list here would hide which of the two happened.

Source

pub async fn all_sprints(&self) -> Result<Vec<Sprint>, ApiError>

Every sprint in the organisation.

board sprints ID needs the board first, and a sprint name is a thing people say without knowing which board it belongs to. This is the same records with the board named on each.

Source

pub async fn queue_local_fields( &self, key: &str, ) -> Result<Vec<FieldSpec>, ApiError>

The fields a queue defines itself.

Not a subset of Self::queue_fields, which lists everything the queue can use: a local field belongs to the queue, is invisible to the organisation-wide listing, and cannot be fetched through /v3/fields at all. So these carry their full definition — what they accept included — because there is no second command that could answer that for them.

Source

pub async fn create_entity( &self, kind: &str, fields: &Value, ) -> Result<Entity, ApiError>

Create a project, portfolio or goal with nothing but a name.

Everything else about an entity is optional, and a command line is not where a portfolio’s description gets written.

Source

pub async fn delete_entity(&self, kind: &str, id: &str) -> Result<(), ApiError>

Delete a project, portfolio or goal.

Entities can be deleted; issues cannot. That asymmetry is why the live suite may write entities and may not write issues without being told a queue to sacrifice.

Source

pub async fn update_entity( &self, kind: &str, id: &str, fields: &Value, version: Option<u64>, ) -> Result<Entity, ApiError>

Change the fields of a project, portfolio or goal.

Quotes the version for the same reason Self::place_entity does: a write without one lands on top of whatever happened in between.

Source

pub async fn place_entity( &self, kind: &str, id: &str, parent: Option<&str>, version: Option<u64>, ) -> Result<Entity, ApiError>

Put an entity inside a portfolio, or take it out of one.

version is Tracker’s optimistic-concurrency counter and is quoted on purpose: without it the write lands whatever happened in between, and with it a portfolio that moved under us answers 412 instead of being silently overwritten.

Source

pub async fn queue(&self, key: &str) -> Result<QueueSettings, ApiError>

One queue and its settings.

Source

pub async fn queue_blueprint(&self, key: &str) -> Result<Blueprint, ApiError>

The parts of a queue that another queue can be built from.

issueTypesConfig pairs each issue type with a workflow and a set of resolutions, and workflow ids are organisation-specific strings nobody has memorised. Copying them from a queue that already works is the only way to create one from a command line without asking for internals.

Source

pub async fn create_queue( &self, body: &Value, ) -> Result<QueueSettings, ApiError>

Create a queue.

Source

pub async fn fields(&self) -> Result<Vec<QueueField>, ApiError>

Every field defined in the organisation, not just one queue’s.

queue fields answers “what can I set on an issue here”; this answers “what exists at all”, which is the question behind a field that a queue does not show.

Source

pub async fn field(&self, key: &str) -> Result<FieldSpec, ApiError>

One field’s definition, by the key queue fields prints.

A local field defined inside one queue is not reachable here — it lives under the queue — and Tracker answers 404 for it, which is the honest answer rather than one worth papering over.

Source

pub async fn templates( &self, kind: TemplateKind, ) -> Result<Vec<Template>, ApiError>

Issue or comment templates.

The path is issueTemplates and commentTemplates; there is no _templates collection, which is worth writing down because every plausible guess at one answers 400 or 404.

Source

pub async fn issue_comments(&self, key: &str) -> Result<Vec<Comment>, ApiError>

The comments of an issue.

Fetched in one generous page: an issue with more than a hundred comments is rare enough that paginating here would cost more in complexity than it saves anyone.

Source

pub async fn queue_fields(&self, key: &str) -> Result<Vec<QueueField>, ApiError>

The fields of a queue, including custom ones, as (key, name, type).

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

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

Formats the value using the given formatter. 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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Create a new Painted with a default Style. Read more
Source§

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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