Struct problem_details::XmlProblemDetails
source · pub struct XmlProblemDetails<Ext = ()>(/* private fields */);
Expand description
ProblemDetails that is encoded to XML when used with web framework integrations.
Example
use http::StatusCode;
use problem_details::{XmlProblemDetails, ProblemDetails};
async fn handler() -> XmlProblemDetails {
ProblemDetails::from_status_code(StatusCode::IM_A_TEAPOT)
.with_detail("short and stout")
.into()
}
Implementations§
source§impl<Ext> XmlProblemDetails<Ext>
impl<Ext> XmlProblemDetails<Ext>
sourcepub const CONTENT_TYPE: &'static str = "application/problem+xml"
pub const CONTENT_TYPE: &'static str = "application/problem+xml"
The HTTP content type for a xml problem details.
source§impl<Ext> XmlProblemDetails<Ext>where
Ext: Serialize,
impl<Ext> XmlProblemDetails<Ext>where
Ext: Serialize,
sourcepub fn to_body_string(&self) -> Result<String, XmlError>
pub fn to_body_string(&self) -> Result<String, XmlError>
Write this problem details to an XML string suitable for a response body.
Trait Implementations§
source§impl<Ext: Clone> Clone for XmlProblemDetails<Ext>
impl<Ext: Clone> Clone for XmlProblemDetails<Ext>
source§fn clone(&self) -> XmlProblemDetails<Ext>
fn clone(&self) -> XmlProblemDetails<Ext>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Ext: Debug> Debug for XmlProblemDetails<Ext>
impl<Ext: Debug> Debug for XmlProblemDetails<Ext>
source§impl<Ext: Default> Default for XmlProblemDetails<Ext>
impl<Ext: Default> Default for XmlProblemDetails<Ext>
source§fn default() -> XmlProblemDetails<Ext>
fn default() -> XmlProblemDetails<Ext>
Returns the “default value” for a type. Read more
source§impl<Ext> Display for XmlProblemDetails<Ext>
impl<Ext> Display for XmlProblemDetails<Ext>
source§impl<Ext> Error for XmlProblemDetails<Ext>where
Ext: Debug,
impl<Ext> Error for XmlProblemDetails<Ext>where
Ext: Debug,
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl<Ext> From<ProblemDetails<Ext>> for XmlProblemDetails<Ext>
impl<Ext> From<ProblemDetails<Ext>> for XmlProblemDetails<Ext>
source§fn from(value: ProblemDetails<Ext>) -> Self
fn from(value: ProblemDetails<Ext>) -> Self
Converts to this type from the input type.
source§impl<Ext> From<XmlProblemDetails<Ext>> for ProblemDetails<Ext>
impl<Ext> From<XmlProblemDetails<Ext>> for ProblemDetails<Ext>
source§fn from(value: XmlProblemDetails<Ext>) -> Self
fn from(value: XmlProblemDetails<Ext>) -> Self
Converts to this type from the input type.
source§impl<Ext> IntoResponse for XmlProblemDetails<Ext>where
Ext: Serialize,
impl<Ext> IntoResponse for XmlProblemDetails<Ext>where
Ext: Serialize,
source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
source§impl<Ext> IntoResponse for XmlProblemDetails<Ext>
impl<Ext> IntoResponse for XmlProblemDetails<Ext>
source§fn into_response(self) -> Response
fn into_response(self) -> Response
Consume itself and return
Response
.source§fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self>
fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self>
Wrap an
impl IntoResponse
to add a header. Read moresource§fn with_content_type<V>(self, content_type: V) -> WithContentType<Self>
fn with_content_type<V>(self, content_type: V) -> WithContentType<Self>
Wrap an
impl IntoResponse
to with a new content type. Read moresource§fn with_status(self, status: StatusCode) -> WithStatus<Self>where
Self: Sized,
fn with_status(self, status: StatusCode) -> WithStatus<Self>where
Self: Sized,
Wrap an
impl IntoResponse
to set a status code. Read moresource§impl<Ext: PartialEq> PartialEq for XmlProblemDetails<Ext>
impl<Ext: PartialEq> PartialEq for XmlProblemDetails<Ext>
source§fn eq(&self, other: &XmlProblemDetails<Ext>) -> bool
fn eq(&self, other: &XmlProblemDetails<Ext>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<Ext> ResponseError for XmlProblemDetails<Ext>
impl<Ext> ResponseError for XmlProblemDetails<Ext>
source§fn status(&self) -> StatusCode
fn status(&self) -> StatusCode
The status code of this error.
source§fn as_response(&self) -> Response
fn as_response(&self) -> Response
Convert this error to a HTTP response.
impl<Ext: Eq> Eq for XmlProblemDetails<Ext>
impl<Ext> StructuralEq for XmlProblemDetails<Ext>
impl<Ext> StructuralPartialEq for XmlProblemDetails<Ext>
Auto Trait Implementations§
impl<Ext> RefUnwindSafe for XmlProblemDetails<Ext>where
Ext: RefUnwindSafe,
impl<Ext> Send for XmlProblemDetails<Ext>where
Ext: Send,
impl<Ext> Sync for XmlProblemDetails<Ext>where
Ext: Sync,
impl<Ext> Unpin for XmlProblemDetails<Ext>where
Ext: Unpin,
impl<Ext> UnwindSafe for XmlProblemDetails<Ext>where
Ext: UnwindSafe,
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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
Call the handler with the given request.
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>>,
Apply a [
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>
Convert the handler into a [
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, ()>
Convert the handler into a [
Service
] and no state.source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService
and no state. Read more§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> IntoResult<T> for Twhere
T: IntoResponse,
impl<T> IntoResult<T> for Twhere
T: IntoResponse,
source§fn into_result(self) -> Result<T, Error>
fn into_result(self) -> Result<T, Error>
Consumes this value returns a
poem::Result<T>
.