pub enum Error {
Show 65 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(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>),
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>),
}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(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>)
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>)
Implementations§
Source§impl Error
impl Error
Source§impl Error
impl Error
pub fn from_errno() -> Self
pub fn bad_database(message: &'static str) -> Self
Sourcepub fn sanitized_message(&self) -> String
pub fn sanitized_message(&self) -> String
Sanitizes public-facing errors that can leak sensitive information.
Sourcepub fn status_code(&self) -> StatusCode
pub fn status_code(&self) -> StatusCode
Returns the HTTP error code or closest approximation based on error variant.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true for “not found” errors. This means anything that qualifies as a “not found” from any variant’s contained error type. This call is often used as a special case to eliminate a contained Option with a Result where Ok(None) is instead Err(e) if e.is_not_found().
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
fn expect_into<Dst: TryFrom<Self>>(self) -> Dstwhere
Self: Sized,
Source§impl<T> Expected for T
impl<T> Expected for T
fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + 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>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 more§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 more§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.