pub struct Problem {
pub type: Option<String>,
pub title: Option<String>,
pub status: u16,
pub detail: Option<String>,
pub instance: Option<String>,
pub extensions: BTreeMap<String, Value>,
}Expand description
RFC 7807 / RFC 9457 problem details document.
All fields except status are optional. extensions carries any extra
implementation-specific members and is flattened into the JSON output.
Fields§
§type: Option<String>URI reference identifying the problem type. Defaults to "about:blank".
title: Option<String>Short, human-readable summary of the problem.
status: u16HTTP status code generated by the origin server.
detail: Option<String>Human-readable explanation specific to this occurrence of the problem.
instance: Option<String>URI reference identifying the specific occurrence.
extensions: BTreeMap<String, Value>Extension members merged into the top-level object.
Implementations§
Source§impl Problem
impl Problem
Sourcepub fn from_status(status: StatusCode) -> Problem
pub fn from_status(status: StatusCode) -> Problem
Builds a problem document from a status code, defaulting title to the
canonical reason phrase.
Sourcepub fn with_detail(self, detail: impl Into<String>) -> Problem
pub fn with_detail(self, detail: impl Into<String>) -> Problem
Sets the detail field.
Sourcepub fn with_instance(self, instance: impl Into<String>) -> Problem
pub fn with_instance(self, instance: impl Into<String>) -> Problem
Sets the instance URI.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Problem
impl<'de> Deserialize<'de> for Problem
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Problem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Problem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Responder for Problem
impl Responder for Problem
Source§fn into_response(self) -> Response<TakoBody>
fn into_response(self) -> Response<TakoBody>
Converts the implementing type into an HTTP response.
Source§impl Serialize for Problem
impl Serialize for Problem
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Problem
impl RefUnwindSafe for Problem
impl Send for Problem
impl Sync for Problem
impl Unpin for Problem
impl UnsafeUnpin for Problem
impl UnwindSafe for Problem
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
Mutably borrows from an owned value. Read more
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> 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> 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>
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 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>
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