pub enum Error {
Show 66 variants
PanicAny(Mutex<Box<dyn Any + Send>>),
Panic(&'static str, Mutex<Box<dyn Any + Send + 'static>>),
Fmt(Error),
FromUtf8(FromUtf8Error),
Io(Error),
ParseFloat(ParseFloatError),
ParseInt(ParseIntError),
Std(Box<dyn Error + Send + Sync + 'static>),
SystemTime(SystemTimeError),
ThreadAccessError(AccessError),
TryFromInt(TryFromIntError),
TryFromSlice(TryFromSliceError),
Utf8(Utf8Error),
CapacityError(CapacityError),
CargoToml(Error),
Clap(Error),
Errno(Errno),
Extension(ExtensionRejection),
Figment(Box<Error>),
HtmlFormDe(Error),
HtmlFormSer(Error),
Http(Error),
HttpHeader(InvalidHeaderValue),
JoinError(JoinError),
Json(Error),
JsParseInt(JsParseIntError),
JsTryFromInt(JsTryFromIntError),
ObjectStore(Error),
Path(PathRejection),
Poison(Cow<'static, str>),
Regex(Error),
Reqwest(Error),
SerdeDe(Cow<'static, str>),
SerdeSer(Cow<'static, str>),
TomlDe(Error),
TomlSer(Error),
TracingFilter(ParseError),
TracingReload(Error),
TypedHeader(TypedHeaderRejection),
UrlParse(ParseError),
Yaml(Error),
Arithmetic(Cow<'static, str>),
AuthCheck(Box<Self>),
BadRequest(ErrorKind, &'static str),
BadServerResponse(Cow<'static, str>),
CanonicalJson(CanonicalJsonError),
Config(&'static str, Cow<'static, str>),
Conflict(Cow<'static, str>),
ContentDisposition(ContentDispositionParseError),
Database(Cow<'static, str>),
FeatureDisabled(Cow<'static, str>),
Federation(OwnedServerName, Error),
HttpJson(StatusCode, Json<Value>),
InconsistentRoomState(&'static str, OwnedRoomId),
IntoHttp(IntoHttpError),
Ldap(Cow<'static, str>),
Mxc(MxcUriError),
Mxid(IdParseError),
PowerLevels(PowerLevelsError),
Redaction(OwnedServerName, CanonicalJsonFieldError),
Request(ErrorKind, Cow<'static, str>, StatusCode),
Ruma(Error),
Signatures(VerificationError),
SignaturesJson(JsonError),
Uiaa(UiaaInfo),
Err(Cow<'static, str>),
}Expand description
Unifies failures raised by the core crate.
Variants preserve typed causes where available and carry contextual text for
domain-specific failures. Conversion implementations allow callers to
propagate common dependency errors with ?.
Variants§
PanicAny(Mutex<Box<dyn Any + Send>>)
Carries an arbitrary panic payload.
The payload is protected by a mutex so the error remains shareable across unwind boundaries. Use the panic helpers to resume unwinding or inspect it.
Panic(&'static str, Mutex<Box<dyn Any + Send + 'static>>)
Carries a panic payload and its extracted static message.
The message supports diagnostics without consuming the payload. The mutex keeps the payload available across unwind boundaries.
Fmt(Error)
Reports a formatting failure.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
FromUtf8(FromUtf8Error)
Reports an invalid UTF-8 byte sequence while constructing a string.
Automatic conversion preserves the original bytes and source error. Its display text is forwarded unchanged.
Io(Error)
Reports an input or output failure.
Automatic conversion preserves the original I/O error and its kind. HTTP response mapping may use the contained error kind.
ParseFloat(ParseFloatError)
Reports a floating-point parsing failure.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
ParseInt(ParseIntError)
Reports an integer parsing failure.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
Std(Box<dyn Error + Send + Sync + 'static>)
Carries a dynamically typed standard error.
The boxed source must be safe to send and share between threads. Its display text and source chain remain available for diagnostics.
SystemTime(SystemTimeError)
Reports a system clock value earlier than the requested reference time.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
ThreadAccessError(AccessError)
Reports failure to access thread-local state.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
TryFromInt(TryFromIntError)
Reports an integer conversion outside the destination range.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
TryFromSlice(TryFromSliceError)
Reports conversion from a slice with an incompatible length.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
Utf8(Utf8Error)
Reports an invalid borrowed UTF-8 byte sequence.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
CapacityError(CapacityError)
Reports that a fixed-capacity collection cannot accept another item.
Automatic conversion preserves the original capacity error. Its display text is forwarded unchanged.
CargoToml(Error)
Reports failure to parse Cargo manifest data.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
Clap(Error)
Reports a command-line parsing or presentation failure.
Automatic conversion preserves the original Clap error. Its display text is forwarded unchanged.
Errno(Errno)
Reports a Unix system error number.
Automatic conversion preserves the original error number. Its display text is forwarded unchanged.
Extension(ExtensionRejection)
Reports rejection of a required Axum request extension.
Automatic conversion preserves the extractor rejection. Its display text is forwarded unchanged.
Figment(Box<Error>)
Reports a configuration extraction failure.
The boxed Figment error preserves its complete source and diagnostic
context. A dedicated conversion boxes it for ordinary ? propagation.
HtmlFormDe(Error)
Reports failure to deserialize an HTML form.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
HtmlFormSer(Error)
Reports failure to serialize an HTML form.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
Http(Error)
Reports failure to construct an HTTP value.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
HttpHeader(InvalidHeaderValue)
Reports an invalid HTTP header value.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
JoinError(JoinError)
Reports failure of a spawned asynchronous task.
The Tokio join error records cancellation and panic state. Panic helpers can recover its payload when the task panicked.
Json(Error)
Reports failure to serialize or deserialize JSON.
Automatic conversion preserves the original source error. Matrix error mapping classifies this variant as invalid JSON.
JsParseInt(JsParseIntError)
Reports failure to parse a Matrix-compatible JavaScript integer.
Automatic conversion preserves the re-exported integer error. Matrix response mapping treats it as a bad request.
JsTryFromInt(JsTryFromIntError)
Reports a value outside the Matrix JavaScript-integer range.
Automatic conversion preserves the re-exported conversion error. Matrix response mapping treats it as a bad request.
ObjectStore(Error)
Reports an object-storage operation failure.
Automatic conversion preserves the backend source error. Its display text is forwarded unchanged.
Path(PathRejection)
Reports rejection of an Axum path parameter.
Automatic conversion preserves the extractor rejection. Its display text is forwarded unchanged.
Poison(Cow<'static, str>)
Reports access to a poisoned synchronization primitive.
The stored text reports the poisoning without retaining the guard. Poison conversion supplies the originating error text.
Regex(Error)
Reports an invalid regular expression.
Automatic conversion preserves the original source error. The formatted message identifies the regex failure.
Reqwest(Error)
Reports an HTTP client request failure.
Automatic conversion preserves status and transport details from Reqwest. HTTP response mapping reuses its status when one is available.
SerdeDe(Cow<'static, str>)
Reports a custom deserialization failure.
The message may borrow static text or own formatted context. It is exposed directly as the error display.
SerdeSer(Cow<'static, str>)
Reports a custom serialization failure.
The message may borrow static text or own formatted context. It is exposed directly as the error display.
TomlDe(Error)
Reports failure to deserialize TOML.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
TomlSer(Error)
Reports failure to serialize TOML.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
TracingFilter(ParseError)
Reports an invalid tracing filter directive.
Automatic conversion preserves the filter parser’s source error. The formatted message identifies the tracing subsystem.
TracingReload(Error)
Reports failure to reload a tracing layer.
Automatic conversion preserves the reload source error. The formatted message identifies the tracing subsystem.
TypedHeader(TypedHeaderRejection)
Reports rejection of a typed HTTP header.
Automatic conversion preserves the extractor rejection. Its display text is forwarded unchanged.
UrlParse(ParseError)
Reports failure to parse a URL.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
Yaml(Error)
Reports failure to serialize or deserialize YAML.
Automatic conversion preserves the original source error. Its display text is forwarded unchanged.
Arithmetic(Cow<'static, str>)
Reports an arithmetic operation that cannot produce a valid result.
The message records contextual conversion, range, overflow, and underflow failures. It can supplement lower-level typed numeric source errors.
AuthCheck(Box<Self>)
State-res auth_check rejection sentinel.
Surfaces to the wire as 403 / M_FORBIDDEN with the Display text
Auth check failed: {inner}. Exists so callers can pattern-match the
cause without grepping the message text.
BadRequest(ErrorKind, &'static str)
Reports a legacy structured Matrix request error.
The variant pairs a Matrix error kind with static public text. Response mapping derives the appropriate HTTP status from that kind.
BadServerResponse(Cow<'static, str>)
Reports an invalid or unusable response from a remote server.
The message carries protocol context suitable for diagnostics. No typed remote response is retained.
CanonicalJson(CanonicalJsonError)
Reports invalid canonical JSON.
Automatic conversion preserves the original canonicalization error. Matrix error mapping classifies this variant as invalid JSON.
Config(&'static str, Cow<'static, str>)
Reports an invalid configuration directive.
The static directive name identifies the setting and the accompanying message explains why its value cannot be used.
Conflict(Cow<'static, str>)
Reports a resource conflict.
This variant currently represents an already occupied room alias. HTTP response mapping emits a conflict status.
ContentDisposition(ContentDispositionParseError)
Reports an invalid Matrix content-disposition header.
Automatic conversion preserves the original parser error. Its display text is forwarded unchanged.
Database(Cow<'static, str>)
Reports a database operation or invariant failure.
The message carries storage context without exposing it in sanitized client-facing output. Database failures default to an internal status.
FeatureDisabled(Cow<'static, str>)
Reports use of a feature disabled by server configuration.
The stored feature name is included in the public message. Matrix response mapping assigns the matching feature-disabled error kind.
Federation(OwnedServerName, Error)
Reports an error response received from a federated server.
The variant preserves both the origin and its structured Matrix error, so internal callers can dispatch on what the remote said. Response mapping does not forward that status and kind unconditionally.
HttpJson(StatusCode, Json<Value>)
Carries a preconstructed HTTP status and JSON response body.
Response mapping preserves the caller-selected status. The formatted JSON becomes the message of a standard Matrix error response.
InconsistentRoomState(&'static str, OwnedRoomId)
Reports an invariant violation in a room’s persisted state.
The static message names the failed invariant and the room identifier locates the affected state.
IntoHttp(IntoHttpError)
Reports failure to convert a Matrix response into HTTP form.
Automatic conversion preserves the original Ruma source error. Its display text is forwarded unchanged.
Ldap(Cow<'static, str>)
Reports an LDAP operation failure.
The message records directory-service context not represented by a common typed source. Response mapping treats it as an internal error.
Mxc(MxcUriError)
Reports an invalid Matrix content URI.
Automatic conversion preserves the original URI error. Its display text is forwarded unchanged.
Mxid(IdParseError)
Reports an invalid Matrix identifier.
Automatic conversion preserves the original identifier parser error. Its display text is forwarded unchanged.
PowerLevels(PowerLevelsError)
Reports invalid room power-level content or arithmetic.
Automatic conversion preserves the original Ruma power-level error. Its display text is forwarded unchanged.
Redaction(OwnedServerName, CanonicalJsonFieldError)
Reports failure to redact canonical JSON from a remote server.
The variant records the origin alongside the invalid canonical field. The formatted message keeps both pieces of context.
Request(ErrorKind, Cow<'static, str>, StatusCode)
Carries a structured Matrix client error response.
The variant stores the Matrix error kind, public message, and preferred HTTP status. Response mapping may refine the status from the kind.
Ruma(Error)
Reports a structured Matrix API error.
Automatic conversion preserves the Ruma status, kind, and message. Response mapping forwards those structured fields.
Signatures(VerificationError)
Reports a Matrix signature verification failure.
Automatic conversion preserves the original verification error. Its display text is forwarded unchanged.
SignaturesJson(JsonError)
Reports invalid JSON encountered during signature processing.
Automatic conversion preserves the signature library’s JSON error. Its display text is forwarded unchanged.
Uiaa(UiaaInfo)
Requests an interactive-authentication challenge response.
The contained UIAA information is serialized for the client rather than treated as an opaque internal failure.
Err(Cow<'static, str>)
Reports an untyped core failure.
The message may borrow static text or own formatted context. This fallback is used when no structured variant represents the failure.
Implementations§
Source§impl Error
impl Error
Sourcepub fn panic(self) -> !
pub fn panic(self) -> !
Starts a panic using the boxed value derived from this error.
Explicit panic variants and task joins that ended by panicking supply their stored boxed value. Other errors are boxed as typed values.
§Panics
Always panics by design.
Sourcepub fn from_panic(e: Box<dyn Any + Send + 'static>) -> Self
pub fn from_panic(e: Box<dyn Any + Send + 'static>) -> Self
Wraps a caught panic payload as an error.
A static string message is extracted when the payload exposes one. The original payload remains available for later unwinding.
Sourcepub fn into_panic(self) -> Box<dyn Any + Send>
pub fn into_panic(self) -> Box<dyn Any + Send>
Converts this error into a boxed value for panicking.
Explicit panic variants and task joins that ended by panicking yield their stored boxed value. Other variants are boxed as typed values.
§Panics
Panics if a stored panic payload’s mutex is poisoned or a task join was cancelled instead of ending with a panic.
Sourcepub fn panic_str(self) -> Option<&'static str>
pub fn panic_str(self) -> Option<&'static str>
Extracts a static message from a carried panic payload.
Non-panic errors return None. Unsupported payload representations
produce an empty string, and the error is consumed while inspecting the
payload.
§Panics
Panics if a stored panic payload’s mutex is poisoned.
Source§impl Error
impl Error
Sourcepub fn from_errno() -> Self
pub fn from_errno() -> Self
Captures the operating system’s most recent error for the current thread.
The error is sampled when this function is called and wrapped as
Error::Io. Platform-specific code remains available through the
source.
Sourcepub fn bad_database(message: &'static str) -> Self
pub fn bad_database(message: &'static str) -> Self
Constructs a database error from static diagnostic text.
The error helper records the call site while preserving the supplied
message. Callers exposing it publicly can use
Error::sanitized_message.
Sourcepub fn sanitized_message(&self) -> String
pub fn sanitized_message(&self) -> String
Produces an error message safe for public responses.
Database and I/O details are replaced with generic text to avoid leaking sensitive context. Other variants retain their normal message.
Sourcepub fn message(&self) -> String
pub fn message(&self) -> String
Formats the diagnostic message for this error.
Federation errors include their origin and Ruma errors use their Matrix
response message. Other variants use their
Display implementation.
Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Returns the Matrix error kind represented by this error.
Structured request and federation variants preserve their supplied kind.
Unclassified internal errors map to M_UNKNOWN.
Sourcepub fn status_code(&self) -> StatusCode
pub fn status_code(&self) -> StatusCode
Returns the HTTP status represented by this error.
Structured variants preserve or derive their protocol status, while I/O and client errors use their available status metadata. Unclassified failures map to an internal-server-error status.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Tests whether this error maps to an HTTP not-found status.
The test includes contained error types whose status mapping yields 404.
Callers can use it to treat Err as the absent case in place of a
nested Option.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn custom<T: Display + ToString>(msg: T) -> Self
fn custom<T: Display + ToString>(msg: T) -> Self
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 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 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 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 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 From<AccessError> for Error
impl From<AccessError> for Error
Source§fn from(source: AccessError) -> Self
fn from(source: AccessError) -> Self
Source§impl From<CapacityError> for Error
impl From<CapacityError> for Error
Source§fn from(source: CapacityError) -> Self
fn from(source: CapacityError) -> Self
Source§impl From<FromUtf8Error> for Error
impl From<FromUtf8Error> for Error
Source§fn from(source: FromUtf8Error) -> Self
fn from(source: FromUtf8Error) -> Self
Source§impl From<Infallible> for Error
impl From<Infallible> for Error
Source§fn from(_e: Infallible) -> Self
fn from(_e: Infallible) -> Self
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Source§impl From<ParseFloatError> for Error
impl From<ParseFloatError> for Error
Source§fn from(source: ParseFloatError) -> Self
fn from(source: ParseFloatError) -> Self
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(source: ParseIntError) -> Self
fn from(source: ParseIntError) -> Self
Source§impl<T> From<PoisonError<T>> for Error
impl<T> From<PoisonError<T>> for Error
Source§fn from(e: PoisonError<T>) -> Self
fn from(e: PoisonError<T>) -> Self
Source§impl From<SystemTimeError> for Error
impl From<SystemTimeError> for Error
Source§fn from(source: SystemTimeError) -> Self
fn from(source: SystemTimeError) -> Self
Source§impl From<TryFromIntError> for Error
impl From<TryFromIntError> for Error
Source§fn from(source: TryFromIntError) -> Self
fn from(source: TryFromIntError) -> Self
Source§impl From<TryFromSliceError> for Error
impl From<TryFromSliceError> for Error
Source§fn from(source: TryFromSliceError) -> Self
fn from(source: TryFromSliceError) -> Self
impl RefUnwindSafe for Error
impl UnwindSafe for Error
Auto Trait Implementations§
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
Source§impl<T> ExpectInto for T
impl<T> ExpectInto for T
Source§impl<T> Expected for T
impl<T> Expected for T
Source§fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§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 moreimpl<T> JsonCastable<CanonicalJsonValue> for T
impl<T> JsonCastable<Value> for T
§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);§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§impl<T> Tried for T
impl<T> Tried for T
Source§fn try_add(self, rhs: Self) -> Result<Self>where
Self: CheckedAdd + Sized,
fn try_add(self, rhs: Self) -> Result<Self>where
Self: CheckedAdd + Sized,
rhs with checked arithmetic. Read moreSource§fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
rhs with checked arithmetic. Read moreSource§fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
rhs with checked arithmetic. Read more