Skip to main content

Error

Enum Error 

Source
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

Source

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.

Source

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.

Source

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.

Source

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

pub fn is_panic(&self) -> bool

Tests whether this error carries a panic payload.

Explicit panic variants always match. A task-join error matches only when the joined task ended by panicking.

Source§

impl Error

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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 Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

Source§

fn custom<T: Display + ToString>(msg: T) -> Self

Raised when there is general error when deserializing a type. Read more
Source§

fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a type different from what it was expecting. Read more
Source§

fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a value of the right type but that is wrong for some other reason. Read more
Source§

fn invalid_length(len: usize, exp: &dyn Expected) -> Self

Raised when deserializing a sequence or map and the input data contains too many or too few elements. Read more
Source§

fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize enum type received a variant with an unrecognized name.
Source§

fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize struct type received a field with an unrecognized name.
Source§

fn missing_field(field: &'static str) -> Self

Raised when a 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

Raised when a Deserialize struct type received more than one of the same field.
Source§

impl Error for Error

Source§

fn custom<T: Display + ToString>(msg: T) -> Self

Used when a Serialize implementation encounters any error while serializing a type. Read more
Source§

impl Error for Error

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<AccessError> for Error

Source§

fn from(source: AccessError) -> Self

Converts to this type from the input type.
Source§

impl From<Box<dyn Error + Send + Sync>> for Error

Source§

fn from(source: Box<dyn Error + Send + Sync + 'static>) -> Self

Converts to this type from the input type.
Source§

impl From<CanonicalJsonError> for Error

Source§

fn from(source: CanonicalJsonError) -> Self

Converts to this type from the input type.
Source§

impl From<CapacityError> for Error

Source§

fn from(source: CapacityError) -> Self

Converts to this type from the input type.
Source§

impl From<ContentDispositionParseError> for Error

Source§

fn from(source: ContentDispositionParseError) -> Self

Converts to this type from the input type.
Source§

impl From<Errno> for Error

Source§

fn from(source: Errno) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for UiaaResponse

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: IdParseError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ExtensionRejection> for Error

Source§

fn from(source: ExtensionRejection) -> Self

Converts to this type from the input type.
Source§

impl From<FromUtf8Error> for Error

Source§

fn from(source: FromUtf8Error) -> Self

Converts to this type from the input type.
Source§

impl From<Infallible> for Error

Source§

fn from(_e: Infallible) -> Self

Converts to this type from the input type.
Source§

impl From<IntoHttpError> for Error

Source§

fn from(source: IntoHttpError) -> Self

Converts to this type from the input type.
Source§

impl From<InvalidHeaderValue> for Error

Source§

fn from(source: InvalidHeaderValue) -> Self

Converts to this type from the input type.
Source§

impl From<JoinError> for Error

Source§

fn from(source: JoinError) -> Self

Converts to this type from the input type.
Source§

impl From<JsonError> for Error

Source§

fn from(source: JsonError) -> Self

Converts to this type from the input type.
Source§

impl From<MxcUriError> for Error

Source§

fn from(source: MxcUriError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseError> for Error

Source§

fn from(source: ParseError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseError> for Error

Source§

fn from(source: ParseError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseFloatError> for Error

Source§

fn from(source: ParseFloatError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseIntError> for Error

Source§

fn from(source: ParseIntError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseIntError> for Error

Source§

fn from(source: JsParseIntError) -> Self

Converts to this type from the input type.
Source§

impl From<PathRejection> for Error

Source§

fn from(source: PathRejection) -> Self

Converts to this type from the input type.
Source§

impl<T> From<PoisonError<T>> for Error

Source§

fn from(e: PoisonError<T>) -> Self

Converts to this type from the input type.
Source§

impl From<PowerLevelsError> for Error

Source§

fn from(source: PowerLevelsError) -> Self

Converts to this type from the input type.
Source§

impl From<SystemTimeError> for Error

Source§

fn from(source: SystemTimeError) -> Self

Converts to this type from the input type.
Source§

impl From<TryFromIntError> for Error

Source§

fn from(source: TryFromIntError) -> Self

Converts to this type from the input type.
Source§

impl From<TryFromIntError> for Error

Source§

fn from(source: JsTryFromIntError) -> Self

Converts to this type from the input type.
Source§

impl From<TryFromSliceError> for Error

Source§

fn from(source: TryFromSliceError) -> Self

Converts to this type from the input type.
Source§

impl From<TypedHeaderRejection> for Error

Source§

fn from(source: TypedHeaderRejection) -> Self

Converts to this type from the input type.
Source§

impl From<Utf8Error> for Error

Source§

fn from(source: Utf8Error) -> Self

Converts to this type from the input type.
Source§

impl From<VerificationError> for Error

Source§

fn from(source: VerificationError) -> Self

Converts to this type from the input type.
Source§

impl IntoResponse for Error

Source§

fn into_response(self) -> Response

Create a response.
Source§

impl RefUnwindSafe for Error

Source§

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

impl<T> DropFlavorWrapper<T> for T

§

type Flavor = MayDrop

The DropFlavor that [wrap]s T into Self
Source§

impl<T> ExpectInto for T

Source§

fn expect_into<Dst: TryFrom<Self>>(self) -> Dst
where Self: Sized,

Converts the value into Dst and returns the successful result. Read more
Source§

impl<T> Expected for T

Source§

fn expected_add(self, rhs: Self) -> Self
where Self: CheckedAdd + Sized,

Adds rhs with an expectation that the operation is valid. Read more
Source§

fn expected_sub(self, rhs: Self) -> Self
where Self: CheckedSub + Sized,

Subtracts rhs with an expectation that the operation is valid. Read more
Source§

fn expected_mul(self, rhs: Self) -> Self
where Self: CheckedMul + Sized,

Multiplies by rhs with an expectation that the operation is valid. Read more
Source§

fn expected_div(self, rhs: Self) -> Self
where Self: CheckedDiv + Sized,

Divides by rhs with an expectation that the operation is valid. Read more
Source§

fn expected_rem(self, rhs: Self) -> Self
where Self: CheckedRem + Sized,

Computes the remainder with an expectation that the operation is valid. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

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

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> JsonCastable<CanonicalJsonValue> for T

§

impl<T> JsonCastable<Value> for T

§

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

§

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 primary(&self) -> Painted<&T>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 bold(&self) -> Painted<&T>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 mask(&self) -> Painted<&T>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Create a new [Painted] with a default [Style]. Read more
§

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
§

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

§

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

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

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

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn add_extension<T>(self, value: T) -> AddExtension<Self, T>
where Self: Sized,

Add some shareable value to request extensions. Read more
§

fn compression(self) -> Compression<Self>
where Self: Sized,

Compresses response bodies. Read more
§

fn decompression(self) -> Decompression<Self>
where Self: Sized,

Decompress response bodies. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
§

fn sensitive_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>
where Self: Sized,

Mark headers as sensitive on both requests and responses. Read more
§

fn sensitive_request_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<Self>
where Self: Sized,

Mark headers as sensitive on requests. Read more
§

fn sensitive_response_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveResponseHeaders<Self>
where Self: Sized,

Mark headers as sensitive on responses. Read more
§

fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request. Read more
§

fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Append a header into the request. Read more
§

fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request, if the header is not already present. Read more
§

fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response. Read more
§

fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Append a header into the response. Read more
§

fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response, if the header is not already present. Read more
§

fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>
where Self: Sized,

Catch panics and convert them into 500 Internal Server responses. Read more
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> Tried for T

Source§

fn try_add(self, rhs: Self) -> Result<Self>
where Self: CheckedAdd + Sized,

Adds rhs with checked arithmetic. Read more
Source§

fn try_sub(self, rhs: Self) -> Result<Self>
where Self: CheckedSub + Sized,

Subtracts rhs with checked arithmetic. Read more
Source§

fn try_mul(self, rhs: Self) -> Result<Self>
where Self: CheckedMul + Sized,

Multiplies by rhs with checked arithmetic. Read more
Source§

fn try_div(self, rhs: Self) -> Result<Self>
where Self: CheckedDiv + Sized,

Divides by rhs with checked arithmetic. Read more
Source§

fn try_rem(self, rhs: Self) -> Result<Self>
where Self: CheckedRem + Sized,

Computes the remainder by rhs with checked arithmetic. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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