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 StatusCode that wraps an inner value, and can thus be used for easy error
propagation while keeping track of the status-code in the type-system.
This trait is implemented for all codes in the codes module.
Required Associated Constants§
Sourceconst STATUS_CODE: StatusCode
const STATUS_CODE: StatusCode
The status code associated with type.
Required Associated Types§
type WithInner<T>: StatusProvider<Inner = T>
Required Methods§
Sourcefn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Convert this status wrapper into its inner value.
Provided Methods§
Sourcefn into_set<E>(self) -> ApiResponse<E>
fn into_set<E>(self) -> ApiResponse<E>
Convert this status wrapper into an [ApiErrorSet] with the
given inner value type. (into can be used as well)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".