#[non_exhaustive]pub enum CanonicalError {
Show 16 variants
#[non_exhaustive] Cancelled {
ctx: CancelledV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] Unknown {
ctx: UnknownV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] InvalidArgument {
ctx: InvalidArgumentV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] DeadlineExceeded {
ctx: DeadlineExceededV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] NotFound {
ctx: NotFoundV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] AlreadyExists {
ctx: AlreadyExistsV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] PermissionDenied {
ctx: PermissionDeniedV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] ResourceExhausted {
ctx: ResourceExhaustedV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] FailedPrecondition {
ctx: FailedPreconditionV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] Aborted {
ctx: AbortedV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] OutOfRange {
ctx: OutOfRangeV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] Unimplemented {
ctx: UnimplementedV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] Internal {
ctx: InternalV1,
detail: String,
},
#[non_exhaustive] ServiceUnavailable {
ctx: ServiceUnavailableV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] DataLoss {
ctx: DataLossV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
#[non_exhaustive] Unauthenticated {
ctx: UnauthenticatedV1,
detail: String,
resource_type: Option<String>,
resource_name: Option<String>,
},
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]Cancelled
Fields
This variant is marked as non-exhaustive
ctx: CancelledV1#[non_exhaustive]Unknown
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvalidArgument
Fields
This variant is marked as non-exhaustive
ctx: InvalidArgumentV1#[non_exhaustive]DeadlineExceeded
Fields
This variant is marked as non-exhaustive
ctx: DeadlineExceededV1#[non_exhaustive]NotFound
Fields
This variant is marked as non-exhaustive
ctx: NotFoundV1#[non_exhaustive]AlreadyExists
Fields
This variant is marked as non-exhaustive
ctx: AlreadyExistsV1#[non_exhaustive]PermissionDenied
Fields
This variant is marked as non-exhaustive
ctx: PermissionDeniedV1#[non_exhaustive]ResourceExhausted
Fields
This variant is marked as non-exhaustive
ctx: ResourceExhaustedV1#[non_exhaustive]FailedPrecondition
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Aborted
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]OutOfRange
Fields
This variant is marked as non-exhaustive
ctx: OutOfRangeV1#[non_exhaustive]Unimplemented
Fields
This variant is marked as non-exhaustive
ctx: UnimplementedV1#[non_exhaustive]Internal
Fields
This variant is marked as non-exhaustive
ctx: InternalV1#[non_exhaustive]DataLoss
Fields
This variant is marked as non-exhaustive
ctx: DataLossV1#[non_exhaustive]Unauthenticated
Fields
This variant is marked as non-exhaustive
ctx: UnauthenticatedV1Implementations§
Source§impl CanonicalError
impl CanonicalError
pub fn internal( detail: impl Into<String>, ) -> ResourceErrorBuilder<ResourceAbsent, NoContext>
pub fn unauthenticated() -> ResourceErrorBuilder<ResourceAbsent, NeedsReason>
Source§impl CanonicalError
impl CanonicalError
pub fn detail(&self) -> &str
pub fn resource_type(&self) -> Option<&str>
pub fn resource_name(&self) -> Option<&str>
Sourcepub fn diagnostic(&self) -> Option<&str>
pub fn diagnostic(&self) -> Option<&str>
Returns the internal diagnostic string for Internal and Unknown
variants, or None for all other categories.
Middleware should call this before converting to Problem so
that the real cause can be logged server-side with the trace_id.
The diagnostic is never included in production wire responses.
pub fn gts_type(&self) -> &'static str
pub fn status_code(&self) -> u16
pub fn title(&self) -> &'static str
Trait Implementations§
Source§impl Clone for CanonicalError
impl Clone for CanonicalError
Source§fn clone(&self) -> CanonicalError
fn clone(&self) -> CanonicalError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CanonicalError
impl Debug for CanonicalError
Source§impl Display for CanonicalError
impl Display for CanonicalError
Source§impl Error for CanonicalError
impl Error for CanonicalError
1.30.0 · 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<CanonicalError> for Problem
impl From<CanonicalError> for Problem
Source§fn from(err: CanonicalError) -> Problem
fn from(err: CanonicalError) -> Problem
Source§impl From<Error> for CanonicalError
impl From<Error> for CanonicalError
Source§fn from(err: Error) -> CanonicalError
fn from(err: Error) -> CanonicalError
Source§impl From<Error> for CanonicalError
impl From<Error> for CanonicalError
Source§fn from(err: Error) -> CanonicalError
fn from(err: Error) -> CanonicalError
Source§impl IntoResponse for CanonicalError
Available on crate feature axum only.
impl IntoResponse for CanonicalError
axum only.Source§fn into_response(self) -> Response<Body>
fn into_response(self) -> Response<Body>
Auto Trait Implementations§
impl Freeze for CanonicalError
impl RefUnwindSafe for CanonicalError
impl Send for CanonicalError
impl Sync for CanonicalError
impl Unpin for CanonicalError
impl UnsafeUnpin for CanonicalError
impl UnwindSafe for CanonicalError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
Source§fn call(
self,
_req: Request<Body>,
_state: S,
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
tower::Layer to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Service by providing the stateSource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Service and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
MakeService and no state. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
MakeService which stores information
about the incoming connection and has no state. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.
Source§impl<T> WithSecurityContext for T
impl<T> WithSecurityContext for T
Source§fn security_ctx<'a>(&'a self, ctx: &'a SecurityContext) -> Secured<'a, T>
fn security_ctx<'a>(&'a self, ctx: &'a SecurityContext) -> Secured<'a, T>
Secured wrapper. Read more