Skip to main content

ToolsetInstallError

Enum ToolsetInstallError 

Source
#[non_exhaustive]
pub enum ToolsetInstallError {
Show 30 variants Io { detail: String, }, PackageTooLarge { cap: usize, }, HashMismatch, SignatureInvalid, UntrustedPublisher { publisher_key_redacted: String, }, TrustSetEmpty, TrustSetMalformed { detail: String, }, InvalidVersion { detail: String, }, InvalidShasum { detail: String, }, InvalidPackageName { detail: String, }, ArchivePathTraversal { entry_name: String, }, ArchiveEntryNameInvalid { detail: String, }, ArchiveDisallowedEntryType, ArchiveDuplicateEntry { entry_name: String, }, ArchiveTooManyEntries { cap: usize, }, ArchiveEntryTooLarge { cap: usize, }, ArchiveTooLarge { cap: usize, }, ArchiveTrailingData, ArchiveBadTopLevel { detail: String, }, ToolsetFormat(ToolsetFormatError), IdentityMismatch { field: &'static str, extracted: String, expected: String, }, AlreadyInstalled { package: String, installed_version: String, }, VersionDowngrade { new_version: String, installed_version: String, }, NotInstalled { package: String, }, PinRecordMalformed { detail: String, }, ToolsetsRootInvalid { detail: String, }, AttestationRequired { package: String, }, AttestationInvalid { detail: &'static str, }, AuditorUntrusted { auditor_key_redacted: String, }, AttestationFieldMismatch { field: &'static str, },
}
Expand description

Typed closed-set error for toolset install and uninstall operations.

§Variant overview

VariantTrigger
IoOS-level I/O failure (file open, read, write, rename, remove).
PackageTooLargePackage bytes exceed crate::MAX_PACKAGE_BYTES.
HashMismatchSHA-256 of package bytes ≠ signed shasum.
SignatureInvalided25519 publisher signature fails verify_strict.
UntrustedPublisherSigner public key not in the publisher trust set.
TrustSetEmptyTrust-set file is absent or contains no entries (publisher or auditor).
TrustSetMalformedTrust-set file contains a malformed or duplicate entry.
InvalidVersionVersion string fails SemVer parse or length cap.
InvalidShasumsigned_shasum argument is not exactly 64 lowercase hex chars.
InvalidPackageNamePackage name fails the [a-z0-9-] validation rule.
ArchivePathTraversalArchive entry path escapes the package root.
ArchiveEntryNameInvalidArchive entry name contains NUL, control bytes, non-UTF-8, or non-ASCII.
ArchiveDisallowedEntryTypeArchive entry is a symlink, hardlink, device, FIFO, or other disallowed type.
ArchiveDuplicateEntryTwo archive entries normalise to the same ASCII-lowercase key.
ArchiveTooManyEntriesArchive entry count exceeds the cap.
ArchiveEntryTooLargeA single entry’s decompressed size exceeds the per-entry cap.
ArchiveTooLargeTotal decompressed output exceeds the cap.
ArchiveTrailingDataGzip stream contains trailing data after the first member (multi-member or garbage rejected).
ArchiveBadTopLevelArchive does not contain exactly one top-level directory named after the package.
ToolsetFormatTOOLSET.md parse/validation failed (wraps ToolsetFormatError).
IdentityMismatchExtracted TOOLSET.md name ≠ signed package name. Version is bound by signature.
AlreadyInstalledToolset is already installed and --force was not supplied.
VersionDowngrade--force reinstall would downgrade the version; requires --allow-downgrade.
NotInstalledUninstall requested for a toolset that is not installed.
PinRecordMalformedStored pin record is invalid (bad name, escaping path, or symlink target) during uninstall.
ToolsetsRootInvalidThe toolsets root directory itself is a symlink leaf (install-time check).
AttestationRequiredToolset declares a key-touching capability but no attestation was supplied and override_attestation is false.
AttestationInvalidAttestation signature fails verify_strict, or auditor_pubkey is not a valid ed25519 point.
AuditorUntrustedAuditor public key is not in the auditor trust set.
AttestationFieldMismatchAn attestation field (package/version/shasum/capabilities) does not match the verified install values.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Io

OS-level I/O error.

The detail string is sanitised (length-capped at 256 chars, control/ANSI stripped) to prevent log-injection.

Fields

§detail: String

Sanitised I/O error detail (std::io::Error Display, capped + stripped).

§

PackageTooLarge

Package bytes exceed the maximum allowed size.

The size limit prevents OOM on untrusted sources; reading is aborted as soon as the limit is reached.

Fields

§cap: usize

Configured cap in bytes.

§

HashMismatch

SHA-256 of the package bytes does not match the signed shasum.

This indicates either data corruption or a tampered package.

§

SignatureInvalid

ed25519 signature failed verify_strict.

The signature was well-formed but cryptographically invalid for the signed payload and claimed publisher key.

§

UntrustedPublisher

The signer public key is not present in the trust set.

The publisher key is redacted to first-5-last-5 in Display output.

Fields

§publisher_key_redacted: String

Publisher G-strkey, redacted to first-5-last-5.

§

TrustSetEmpty

Trust-set file is absent or contains no entries.

An empty trust set means no toolset can be installed (fail-closed).

§

TrustSetMalformed

Trust-set file contains a malformed or duplicate entry.

The entire file is rejected on any single bad entry (ALL-OR-NOTHING parse contract).

Fields

§detail: String

Sanitised description of the malformed entry.

§

InvalidVersion

Version string fails SemVer parse or exceeds the length cap.

For package-name failures see ToolsetInstallError::InvalidPackageName. For shasum format failures see ToolsetInstallError::InvalidShasum.

Fields

§detail: String

Sanitised description of the parse failure.

§

InvalidShasum

Shasum argument fails format validation.

The signed_shasum argument must be exactly 64 lowercase hexadecimal characters ([0-9a-f]). Uppercase hex digits, wrong length, or non-hex characters all trigger this variant before any hash comparison or signature verification.

Fields

§detail: String

Sanitised description of the format failure.

§

InvalidPackageName

Package name fails the [a-z0-9-] validation rule.

A package name must be non-empty, ≤ 64 characters, contain only lowercase ASCII letters, digits, and hyphens, and must not start, end, or contain consecutive hyphens.

Fields

§detail: String

Sanitised description of the validation failure.

§

ArchivePathTraversal

Archive entry path escapes the package root.

Triggered by .. components, absolute paths, drive prefixes, or root-only paths.

Fields

§entry_name: String

Sanitised entry name (length-capped, control/ANSI stripped).

§

ArchiveEntryNameInvalid

Archive entry name contains NUL, control bytes, or non-UTF-8 bytes.

Entry names are validated before any path comparison.

Fields

§detail: String

Sanitised description of the invalid name.

§

ArchiveDisallowedEntryType

Archive entry is a disallowed type (symlink, hardlink, device, FIFO, etc.).

Type check is performed FIRST, before any path or body read.

§

ArchiveDuplicateEntry

Two archive entries normalise to the same ASCII-lowercase key.

Rejected to prevent APFS/HFS+ case-folding attacks. ASCII-lowercase collision detection is used; full Unicode NFC+case-fold is not yet implemented.

Fields

§entry_name: String

Sanitised entry name that triggered the collision.

§

ArchiveTooManyEntries

Archive entry count exceeds the configured cap.

Fields

§cap: usize

Configured entry count cap.

§

ArchiveEntryTooLarge

A single entry’s decompressed size exceeds the per-entry cap.

Fields

§cap: usize

Per-entry decompressed byte cap.

§

ArchiveTooLarge

Total decompressed output exceeds the cap.

Fields

§cap: usize

Total decompressed byte cap.

§

ArchiveTrailingData

Gzip stream contains trailing data after the first member.

Any non-zero byte after the first gzip footer is rejected — whether it forms a second gzip member (multi-member concatenation) or is arbitrary garbage. Only tar end-of-archive zero padding is tolerated.

§

ArchiveBadTopLevel

Archive top-level shape is invalid.

A valid package must contain exactly one top-level directory whose name equals the package name.

Fields

§detail: String

Sanitised description of the top-level shape found.

§

ToolsetFormat(ToolsetFormatError)

TOOLSET.md parse or validation failed.

Wraps ToolsetFormatError; the staging directory is rolled back on this error.

§

IdentityMismatch

Extracted TOOLSET.md name does not match the signed package name.

Version identity is established by the SIGNATURE BINDING — the signed tuple includes the version string, so a package cannot be relabeled to a different version without invalidating the signature. Only the name field is content-cross-checked here because TOOLSET.md carries a name but no version field.

The field is always "name" in current code; "version" is reserved for a future format revision that adds a version field to TOOLSET.md.

Fields

§field: &'static str

Which field mismatched ("name"; "version" reserved for future use).

§extracted: String

The value found in the extracted TOOLSET.md (sanitised).

§expected: String

The value from the signed package identity tuple (sanitised).

§

AlreadyInstalled

Toolset is already installed and --force was not supplied.

Fields

§package: String

Package name (validated [a-z0-9-]).

§installed_version: String

Currently installed version string.

§

VersionDowngrade

--force reinstall would downgrade the installed version.

Downgrade (installing an older version over a newer one) is refused by default; pass --allow-downgrade to override.

Fields

§new_version: String

New version being installed.

§installed_version: String

Currently installed version.

§

NotInstalled

Uninstall was requested for a toolset that is not installed.

Fields

§package: String

Package name requested for uninstall (validated).

§

PinRecordMalformed

The stored pin record is invalid.

Triggered during uninstall when the pin record’s package name fails validation or the reconstructed path escapes the toolsets root or resolves to a symlink. NOT used for install-time toolsets-root checks; see ToolsetInstallError::ToolsetsRootInvalid for those.

Fields

§detail: String

Sanitised description of the malformed field.

§

ToolsetsRootInvalid

The toolsets root directory is invalid at install time.

Triggered when the toolsets root directory leaf is a symlink (no-follow discipline). Distinct from ToolsetInstallError::PinRecordMalformed which covers uninstall pin-record issues.

Fields

§detail: String

Sanitised description of the invalid root.

§

AttestationRequired

Toolset declares a key-touching capability but no attestation was supplied and override_attestation is false.

A key-touching toolset (e.g. sign-payment) MUST be accompanied by a valid auditor attestation when override_attestation is false. Absent attestation → install is refused before any artefact is written.

Fields

§package: String

Package name (validated [a-z0-9-]).

§

AttestationInvalid

Attestation signature is cryptographically invalid.

Covers both cases opaquely:

  • auditor_pubkey is not a valid compressed ed25519 point.
  • ed25519 verify_strict fails for the attestation signature over the canonical preimage.

The error is intentionally opaque — no key bytes, no signature bytes, no oracle for an attacker to distinguish the two cases.

Fields

§detail: &'static str

Opaque, non-attacker-influenced description (&'static str).

Uses &'static str so no heap allocation occurs and the set of possible messages is closed at compile time.

§

AuditorUntrusted

Auditor public key is not in the auditor trust set.

The auditor key carried in the attestation is not present in <toolsets_dir>/auditor-trust.txt. Note that the auditor trust set is DISTINCT from the publisher trust set (trust.txt) — placing a key in trust.txt does NOT implicitly grant auditor status.

The auditor key is redacted to first-5-last-5 in Display.

Fields

§auditor_key_redacted: String

Auditor G-strkey, redacted to first-5-last-5.

§

AttestationFieldMismatch

An attestation field does not match the verified install values.

One of package, version, shasum, or capabilities in the ToolsetAttestation struct does not equal the value from the verified install context. This prevents cross-package / version / capability replay attacks.

The field is a closed set of &'static str values — "package" / "version" / "shasum" / "capabilities" — so no attacker-controlled string reaches the error.

Fields

§field: &'static str

Which field mismatched: "package" / "version" / "shasum" / "capabilities".

Closed set of &'static str — no attacker-influenced string.

Implementations§

Source§

impl ToolsetInstallError

Source

pub fn from_io(err: Error) -> Self

Constructs an ToolsetInstallError::Io from a std::io::Error.

The error’s Display string is sanitised (length-capped at 256 chars, control/ANSI stripped) to prevent log-injection.

§Examples
use stellar_agent_toolsets_install::error::ToolsetInstallError;

let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "file not found");
let err = ToolsetInstallError::from_io(io_err);
assert!(matches!(err, ToolsetInstallError::Io { .. }));

Trait Implementations§

Source§

impl Debug for ToolsetInstallError

Source§

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

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

impl Display for ToolsetInstallError

Source§

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

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

impl Error for ToolsetInstallError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ToolsetFormatError> for ToolsetInstallError

Source§

fn from(source: ToolsetFormatError) -> Self

Converts to this type from the input type.

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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, !>

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