#[non_exhaustive]pub enum Error {
Show 28 variants
Parse(String),
ParseWithLocation {
message: String,
location: Location,
},
Serialize(String),
Deserialize(String),
DeserializeWithLocation {
message: String,
location: Location,
},
Io(Error),
Custom(String),
RecursionLimitExceeded {
depth: usize,
},
DuplicateKey(String),
KeyCollision(String),
RepetitionLimitExceeded,
Budget(BudgetBreach),
UnknownAnchor(String),
UnknownAnchorAt {
name: String,
location: Location,
suggestion: Option<(String, Location)>,
},
MissingField(String),
UnknownField(String),
ScalarInMergeElement,
SequenceInMergeElement,
TaggedInMerge,
Invalid(String),
TypeMismatch {
expected: &'static str,
found: String,
},
Shared(Arc<Error>),
EndOfStream,
MoreThanOneDocument,
ScalarInMerge,
EmptyTag,
FailedToParseNumber(String),
Message(String, Option<usize>),
}Expand description
§Examples
use noyalib::{from_str, Error, Value};
let err = from_str::<Value>("a: [unclosed").unwrap_err();
assert!(matches!(err, Error::Parse(_) | Error::ParseWithLocation { .. }));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parse(String)
ParseWithLocation
Error during YAML parsing with location information.
§Examples
use noyalib::{Error, Location};
let _e = Error::ParseWithLocation {
message: "bad token".into(),
location: Location::from_index("a: [", 3),
};Fields
message: StringThe error message.
§Examples
use noyalib::{Error, Location};
let e = Error::ParseWithLocation {
message: "bad".into(),
location: Location::default(),
};
if let Error::ParseWithLocation { message, .. } = e {
assert_eq!(message, "bad");
}location: LocationThe location in the source where the error occurred.
§Examples
use noyalib::{Error, Location};
let e = Error::ParseWithLocation {
message: "x".into(),
location: Location::from_index("abc", 1),
};
if let Error::ParseWithLocation { location, .. } = e {
assert_eq!(location.column(), 2);
}Serialize(String)
Deserialize(String)
Error during deserialization.
§Examples
let _e = noyalib::Error::Deserialize("type mismatch".into());DeserializeWithLocation
Error during deserialization with location information.
§Examples
use noyalib::{Error, Location};
let _e = Error::DeserializeWithLocation {
message: "expected int".into(),
location: Location::default(),
};Fields
message: StringThe error message.
§Examples
use noyalib::{Error, Location};
let e = Error::DeserializeWithLocation {
message: "m".into(),
location: Location::default(),
};
if let Error::DeserializeWithLocation { message, .. } = e {
assert_eq!(message, "m");
}location: LocationThe location in the source where the error occurred.
§Examples
use noyalib::{Error, Location};
let e = Error::DeserializeWithLocation {
message: "m".into(),
location: Location::from_index("ab", 1),
};
if let Error::DeserializeWithLocation { location, .. } = e {
assert_eq!(location.column(), 2);
}Io(Error)
std only.I/O error (requires std feature).
§Examples
let ioe = std::io::Error::new(std::io::ErrorKind::Other, "nope");
let _e = noyalib::Error::Io(ioe);Custom(String)
RecursionLimitExceeded
Error when recursion depth limit is exceeded.
§Examples
let _e = noyalib::Error::RecursionLimitExceeded { depth: 64 };Fields
DuplicateKey(String)
Error when a duplicate key is encountered.
§Examples
let _e = noyalib::Error::DuplicateKey("name".into());KeyCollision(String)
Two distinct-typed keys collapsed to the same string key.
The mapping key model is Mapping<String, Value>, so keys are
stringified. Distinct YAML keys that share a spelling — e.g. the
integer 1 and the string "1", or true and "true" — would
silently overwrite each other, losing an entry. This is raised
instead, carrying the collapsed string key. Unlike
Self::DuplicateKey, it fires regardless of DuplicateKeyPolicy
because it is data loss, not an authored duplicate.
§Examples
The construction shape:
let _e = noyalib::Error::KeyCollision("1".into());Reproduces from real YAML. The integer key 1 and the
string key "1" both stringify to "1", so parsing must
refuse rather than silently drop the first entry:
use noyalib::{Error, Value, from_str};
let err = from_str::<Value>("1: a\n\"1\": b\n").unwrap_err();
assert!(matches!(err, Error::KeyCollision(_)));RepetitionLimitExceeded
Repetition limit exceeded (security limit against billion-laughs).
§Examples
let _e = noyalib::Error::RepetitionLimitExceeded;Budget(BudgetBreach)
A configurable parser budget was exceeded.
Carries a BudgetBreach identifying which limit fired,
the configured cap, and (where meaningful) the observed
value at the moment the cap tripped. Distinct from the
older Error::RecursionLimitExceeded /
Error::RepetitionLimitExceeded variants — those stay
for backwards compatibility on the depth / alias-expansion
limits; new budgets in the v0.0.2 expansion (max_events,
max_nodes, max_total_scalar_bytes, max_documents,
max_merge_keys, alias_anchor_ratio) all flow through
Error::Budget.
§Examples
use noyalib::{BudgetBreach, Error};
let _e = Error::Budget(BudgetBreach::MaxDocuments {
limit: 1_000,
observed: 1_001,
});UnknownAnchor(String)
UnknownAnchorAt
Unknown anchor encountered at a specific location.
§Examples
use noyalib::{Error, Location};
let _e = Error::UnknownAnchorAt {
name: "x".into(),
location: Location::default(),
suggestion: None,
};Fields
name: StringThe anchor name.
§Examples
use noyalib::{Error, Location};
let e = Error::UnknownAnchorAt {
name: "x".into(),
location: Location::default(),
suggestion: None,
};
if let Error::UnknownAnchorAt { name, .. } = e {
assert_eq!(name, "x");
}location: LocationThe location where it was used.
§Examples
use noyalib::{Error, Location};
let e = Error::UnknownAnchorAt {
name: "x".into(),
location: Location::from_index("ab", 1),
suggestion: None,
};
if let Error::UnknownAnchorAt { location, .. } = e {
assert_eq!(location.column(), 2);
}suggestion: Option<(String, Location)>Optional suggestion for a similar anchor.
§Examples
use noyalib::{Error, Location};
let e = Error::UnknownAnchorAt {
name: "x".into(),
location: Location::default(),
suggestion: Some(("y".into(), Location::default())),
};
if let Error::UnknownAnchorAt { suggestion: Some((s, _)), .. } = e {
assert_eq!(s, "y");
}MissingField(String)
UnknownField(String)
Unknown field in a mapping (with deny_unknown_fields).
§Examples
let _e = noyalib::Error::UnknownField("extra".into());ScalarInMergeElement
Scalar encountered where a mapping was expected during merge.
§Examples
let _e = noyalib::Error::ScalarInMergeElement;SequenceInMergeElement
Sequence encountered where a mapping was expected during merge.
§Examples
let _e = noyalib::Error::SequenceInMergeElement;TaggedInMerge
Invalid(String)
Generic invalid construct error.
§Examples
let _e = noyalib::Error::Invalid("bad construct".into());TypeMismatch
A type mismatch error.
§Examples
let _e = noyalib::Error::TypeMismatch {
expected: "integer",
found: "string".into(),
};Fields
Shared error instance (Arc-wrapped for cloning).
§Examples
use std::sync::Arc;
let _e = noyalib::Error::Shared(Arc::new(noyalib::Error::EndOfStream));EndOfStream
MoreThanOneDocument
More than one document found where one was expected.
§Examples
let _e = noyalib::Error::MoreThanOneDocument;ScalarInMerge
EmptyTag
FailedToParseNumber(String)
Failed to parse a number.
§Examples
let _e = noyalib::Error::FailedToParseNumber("not-a-number".into());Message(String, Option<usize>)
A message error from Serde (compat variant).
§Examples
let _e = noyalib::Error::Message("oops".into(), Some(42));Implementations§
Source§impl Error
impl Error
Sourcepub fn render_with_formatter(&self, formatter: &dyn MessageFormatter) -> String
pub fn render_with_formatter(&self, formatter: &dyn MessageFormatter) -> String
Render this error via a custom MessageFormatter.
Pairs with DefaultFormatter (developer-facing,
verbatim) and UserFormatter (user-facing, simplified).
Callers needing localisation or rich formatting plug in
their own MessageFormatter impl.
§Examples
use noyalib::i18n::UserFormatter;
use noyalib::{from_str, Value};
let err = from_str::<Value>("a: [unclosed").unwrap_err();
let msg = err.render_with_formatter(&UserFormatter);
assert!(msg.contains("syntax error"));Source§impl Error
impl Error
Sourcepub fn location(&self) -> Option<Location>
pub fn location(&self) -> Option<Location>
Get the location of the error, if any.
§Examples
use noyalib::{from_str, Value};
let err = from_str::<Value>("a: [unclosed").unwrap_err();
let _ = err.location();Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Coarse-grained classification for routing without matching
every variant of the #[non_exhaustive] Error enum.
The mapping is stable across variant additions: new
variants land under an existing ErrorKind whenever
possible, so downstream match err.kind() sites keep
compiling. When a new category is needed the enum grows
(also #[non_exhaustive]).
§Examples
use noyalib::{from_str, ErrorKind, Value};
let syntax = from_str::<Value>("a: [unclosed").unwrap_err();
assert_eq!(syntax.kind(), ErrorKind::Syntax);
let collision = from_str::<Value>("1: a\n\"1\": b\n").unwrap_err();
assert_eq!(collision.kind(), ErrorKind::KeyCollision);Sourcepub fn format_with_source(&self, source: &str) -> String
pub fn format_with_source(&self, source: &str) -> String
Format the error with source context. If the error carries a source
location and the line is in range, the output includes a
line <n>:<col> prefix, the offending line, and a caret (^)
pointing at the column. Out-of-range lines fall back to plain
Display.
For rustc-style multi-line context with surrounding lines, use
Self::format_with_source_radius.
§Examples
use noyalib::{from_str, Value};
let source = "a: [unclosed";
let err = from_str::<Value>(source).unwrap_err();
let formatted = err.format_with_source(source);
assert!(formatted.contains("error"));Sourcepub fn format_with_source_radius(&self, source: &str, radius: usize) -> String
pub fn format_with_source_radius(&self, source: &str, radius: usize) -> String
Format the error with radius lines of context above and
below the offending line — rustc-style. Each line gets a line
number on the left; the caret line under the offending column
is unnumbered. The output is byte-for-byte stable across
minor releases (no terminal escape codes, no
platform-conditional whitespace).
Out-of-range locations fall back to plain Display (no
snippet) — same contract as Self::format_with_source.
§Examples
use noyalib::{from_str, Value};
// Indentation-mismatch error — carries a concrete `(line,
// column)` location, so the snippet renderer engages.
let source = "\
header: ok
service:
nested: x
bad: y
trailer: ok
";
let e = from_str::<Value>(source).unwrap_err();
let formatted = e.format_with_source_radius(source, 1);
// Output includes the offending line plus a single line
// of context above and below.
assert!(formatted.contains("|"));
assert!(formatted.contains("bad: y"));Sourcepub fn format_with_source_truncated(
&self,
source: &str,
max_chars: usize,
) -> String
pub fn format_with_source_truncated( &self, source: &str, max_chars: usize, ) -> String
Format the error with source context, capped at max_chars
ASCII characters — the bridged-channel-friendly variant
of Self::format_with_source. Use when the diagnostic is
destined for a Slack message, a Sentry tag, a structured
log field, or any sink with a hard length budget.
§Truncation contract
- The output is plain ASCII (the renderer already emits no ANSI escapes, so this is a no-op for that axis).
- If the rendered string is
<= max_chars, returns it unchanged. - Otherwise truncates at a UTF-8 character boundary
<= max_chars - 3and appends an...ellipsis so the final length is at mostmax_chars. max_charssmaller than 3 keeps as much of the prefix as fits and drops the ellipsis (so amax_chars = 2yields exactly two characters of the message).
§Examples
use noyalib::{from_str, Value};
let source = "a: [unclosed";
let err = from_str::<Value>(source).unwrap_err();
let short = err.format_with_source_truncated(source, 60);
assert!(short.len() <= 60);
// Untrimmed output is the same as `format_with_source`:
let full = err.format_with_source(source);
let unbounded = err.format_with_source_truncated(source, full.len() + 100);
assert_eq!(unbounded, full);Sourcepub fn format_with_source_radius_truncated(
&self,
source: &str,
radius: usize,
max_chars: usize,
) -> String
pub fn format_with_source_radius_truncated( &self, source: &str, radius: usize, max_chars: usize, ) -> String
Format the error with multi-line radius context, capped
at max_chars. Same truncation contract as
Self::format_with_source_truncated.
§Examples
use noyalib::{from_str, Value};
let source = "a:\n b:\n c: [unclosed";
let err = from_str::<Value>(source).unwrap_err();
let s = err.format_with_source_radius_truncated(source, 1, 80);
assert!(s.len() <= 80);Convert the error into a shared Arc pointer. If the error is
already Error::Shared, the inner Arc is reused without
double-wrapping.
§Examples
let shared = noyalib::Error::EndOfStream.into_shared();
assert!(matches!(&*shared, noyalib::Error::EndOfStream));Check if the error is a shared error.
§Examples
use std::sync::Arc;
let e = noyalib::Error::Shared(Arc::new(noyalib::Error::EndOfStream));
assert!(e.is_shared());Sourcepub fn as_inner(&self) -> Option<&Self>
pub fn as_inner(&self) -> Option<&Self>
Access the inner error if this is a shared error.
§Examples
use std::sync::Arc;
let e = noyalib::Error::Shared(Arc::new(noyalib::Error::EndOfStream));
assert!(e.as_inner().is_some());Sourcepub fn parse_at(message: impl Into<String>, source: &str, index: usize) -> Self
pub fn parse_at(message: impl Into<String>, source: &str, index: usize) -> Self
Create a new parse error at the given index.
§Examples
let e = noyalib::Error::parse_at("bad", "a: x", 3);
assert!(matches!(e, noyalib::Error::ParseWithLocation { .. }));Sourcepub fn deserialize_at(
message: impl Into<String>,
source: &str,
index: usize,
) -> Self
pub fn deserialize_at( message: impl Into<String>, source: &str, index: usize, ) -> Self
Create a new deserialization error at the given index.
§Examples
let e = noyalib::Error::deserialize_at("bad", "a: x", 3);
assert!(matches!(e, noyalib::Error::DeserializeWithLocation { .. }));Create a new error from a shared error pointer.
§Examples
use std::sync::Arc;
let e = noyalib::Error::from_shared(Arc::new(noyalib::Error::EndOfStream));
assert!(e.is_shared());Sourcepub fn render(&self, source: &str) -> String
pub fn render(&self, source: &str) -> String
Render the error in rustc-style with default options.
Equivalent to
self.render_with_options(source, &RenderOptions::default()).
Issue #2 entry point — supersedes Self::format_with_source
for new code; that method is preserved for backwards
compatibility.
§Examples
use noyalib::{from_str, Value};
let source = "a:\n b: 1\n c: 2\n"; // misaligned indent
let err = from_str::<Value>(source).unwrap_err();
let rendered = err.render(source);
assert!(rendered.contains("error"));Sourcepub fn render_with_options(&self, source: &str, opts: &RenderOptions) -> String
pub fn render_with_options(&self, source: &str, opts: &RenderOptions) -> String
Render the error with caller-controlled options.
RenderOptions::crop_radius sets how many lines of context
surround the offending line; RenderOptions::color enables
terminal ANSI colour codes. The default
(RenderOptions::default()) is crop_radius = 2,
color = false.
§Examples
use noyalib::{from_str, RenderOptions, Value};
let source = "a: [unclosed";
let err = from_str::<Value>(source).unwrap_err();
let opts = RenderOptions { crop_radius: 1, color: false };
let rendered = err.render_with_options(source, &opts);
assert!(rendered.contains("error"));Trait Implementations§
Source§impl Diagnostic for Error
Available on crate feature miette only.
impl Diagnostic for Error
miette only.Source§fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine.Source§fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Diagnostic’s Diagnostic::labels to.Source§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Diagnostic’s Diagnostic::source_codeSource§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
ReportHandlers to change the display format
of this diagnostic. Read moreSource§fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Diagnostic.Diagnostics.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl Error for Error
impl Error for Error
Source§fn custom<T: Display>(msg: T) -> Self
fn custom<T: Display>(msg: T) -> Self
Source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Deserialize struct type expected to receive a required
field with a particular name but that field was not present in the
input.Source§fn unknown_field(field: &str, _expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, _expected: &'static [&'static str]) -> Self
Deserialize struct type received a field with an
unrecognized name.Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a type different from what it was
expecting. Read moreSource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a value of the right type but that
is wrong for some other reason. Read moreSource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Deserialize enum type received a variant with an
unrecognized name.Source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Deserialize struct type received more than one of the
same field.Source§impl<'de> IntoDeserializer<'de, Error> for &'de Value
impl<'de> IntoDeserializer<'de, Error> for &'de Value
Source§type Deserializer = &'de Value
type Deserializer = &'de Value
Source§fn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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<T> ErasedDestructor for Twhere
T: 'static,
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 moreimpl<T> MaybeSendSync for T
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§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();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§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();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§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();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§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();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.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§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);Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more