pub trait StatusProvider: From<Self::Inner> + Sized {
type Inner;
type WithInner<T>: StatusProvider<Inner = T>;
const STATUS_CODE: StatusCode;
// Required method
fn into_inner(self) -> Self::Inner;
// Provided methods
fn into_set<E>(self) -> ApiResponse<E>
where Self::Inner: IntoResponse,
E: Contains<Self> { ... }
fn map<T>(self, f: impl FnOnce(Self::Inner) -> T) -> Self::WithInner<T> { ... }
}Expand description
A wrapper type that pairs a body with a fixed HTTP status code.
This trait is implemented for every status code in codes. The status code is part of
the type, which is what lets ApiResponse track which codes a handler can return.
Required Associated Constants§
Sourceconst STATUS_CODE: StatusCode
const STATUS_CODE: StatusCode
The status code of this wrapper.
Required Associated Types§
Sourcetype WithInner<T>: StatusProvider<Inner = T>
type WithInner<T>: StatusProvider<Inner = T>
The same status code with a different body type, for example NotFound<T> for
NotFound<String>.
Required Methods§
Sourcefn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Returns the wrapped body.
Provided Methods§
Sourcefn into_set<E>(self) -> ApiResponse<E>
fn into_set<E>(self) -> ApiResponse<E>
Converts into an ApiResponse whose set contains this status code. This is the
same as calling into().
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".