pub enum ApiRes<T: Serialize> {
Show 63 variants
Custom(u16, u32, String, Option<T>),
Ok(T),
OkWith(u32, String, T),
Empty,
Continue(String),
SwitchingProtocols(String),
Processing(String),
Created(String),
Accepted(String),
NonAuthoritativeInformation(String),
NoContent(String),
ResetContent(String),
PartialContent(String),
MultiStatus(String),
AlreadyReported(String),
IMUsed(String),
MultipleChoices(String),
MovedPermanently(String),
Found(String),
SeeOther(String),
NotModified(String),
UseProxy(String),
TemporaryRedirect(String),
PermanentRedirect(String),
BadRequest(String),
Unauthorized(String),
PaymentRequired(String),
Forbidden(String),
NotFound(String),
MethodNotAllowed(String),
NotAcceptable(String),
ProxyAuthenticationRequired(String),
RequestTimeout(String),
Conflict(String),
Gone(String),
LengthRequired(String),
PreconditionFailed(String),
PayloadTooLarge(String),
URITooLong(String),
UnsupportedMediaType(String),
RangeNotSatisfiable(String),
ExpectationFailed(String),
ImATeapot(String),
MisdirectedRequest(String),
UnprocessableEntity(String),
Locked(String),
FailedDependency(String),
UpgradeRequired(String),
PreconditionRequired(String),
TooManyRequests(String),
RequestHeaderFieldsTooLarge(String),
UnavailableForLegalReasons(String),
InternalServerError(String),
NotImplemented(String),
BadGateway(String),
ServiceUnavailable(String),
GatewayTimeout(String),
HttpVersionNotSupported(String),
VariantAlsoNegotiates(String),
InsufficientStorage(String),
LoopDetected(String),
NotExtended(String),
NetworkAuthenticationRequired(String),
}Variants§
Custom(u16, u32, String, Option<T>)
Custom response with status code, error code, message, and optional data
Ok(T)
200 OK with data [RFC7231, Section 6.3.1]
OkWith(u32, String, T)
200 OK with additional status code and message [RFC7231, Section 6.3.1]
Empty
200 OK empty data
Continue(String)
100 Continue [RFC7231, Section 6.2.1]
SwitchingProtocols(String)
101 Switching Protocols [RFC7231, Section 6.2.2]
Processing(String)
102 Processing [RFC2518]
Created(String)
201 Created [RFC7231, Section 6.3.2]
Accepted(String)
202 Accepted [RFC7231, Section 6.3.3]
NonAuthoritativeInformation(String)
203 Non-Authoritative Information [RFC7231, Section 6.3.4]
NoContent(String)
204 No Content [RFC7231, Section 6.3.5]
ResetContent(String)
205 Reset Content [RFC7231, Section 6.3.6]
PartialContent(String)
206 Partial Content [RFC7233, Section 4.1]
MultiStatus(String)
207 Multi-Status [RFC4918]
AlreadyReported(String)
208 Already Reported [RFC5842]
IMUsed(String)
226 IM Used [RFC3229]
MultipleChoices(String)
300 Multiple Choices [RFC7231, Section 6.4.1]
MovedPermanently(String)
301 Moved Permanently [RFC7231, Section 6.4.2]
Found(String)
302 Found [RFC7231, Section 6.4.3]
SeeOther(String)
303 See Other [RFC7231, Section 6.4.4]
NotModified(String)
304 Not Modified [RFC7232, Section 4.1]
UseProxy(String)
305 Use Proxy [RFC7231, Section 6.4.5]
TemporaryRedirect(String)
307 Temporary Redirect [RFC7231, Section 6.4.7]
PermanentRedirect(String)
308 Permanent Redirect [RFC7238]
BadRequest(String)
400 Bad Request [RFC7231, Section 6.5.1]
401 Unauthorized [RFC7235, Section 3.1]
PaymentRequired(String)
402 Payment Required [RFC7231, Section 6.5.2]
Forbidden(String)
403 Forbidden [RFC7231, Section 6.5.3]
NotFound(String)
404 Not Found [RFC7231, Section 6.5.4]
MethodNotAllowed(String)
405 Method Not Allowed [RFC7231, Section 6.5.5]
NotAcceptable(String)
406 Not Acceptable [RFC7231, Section 6.5.6]
ProxyAuthenticationRequired(String)
407 Proxy Authentication Required [RFC7235, Section 3.2]
RequestTimeout(String)
408 Request Timeout [RFC7231, Section 6.5.7]
Conflict(String)
409 Conflict [RFC7231, Section 6.5.8]
Gone(String)
410 Gone [RFC7231, Section 6.5.9]
LengthRequired(String)
411 Length Required [RFC7231, Section 6.5.10]
PreconditionFailed(String)
412 Precondition Failed [RFC7232, Section 4.2]
PayloadTooLarge(String)
413 Payload Too Large [RFC7231, Section 6.5.11]
URITooLong(String)
414 URI Too Long [RFC7231, Section 6.5.12]
UnsupportedMediaType(String)
415 Unsupported Media Type [RFC7231, Section 6.5.13]
RangeNotSatisfiable(String)
416 Range Not Satisfiable [RFC7233, Section 4.4]
ExpectationFailed(String)
417 Expectation Failed [RFC7231, Section 6.5.14]
ImATeapot(String)
418 I’m a teapot [curiously not registered by IANA but RFC2324]
MisdirectedRequest(String)
421 Misdirected Request RFC7540, Section 9.1.2
UnprocessableEntity(String)
422 Unprocessable Entity [RFC4918]
Locked(String)
423 Locked [RFC4918]
FailedDependency(String)
424 Failed Dependency [RFC4918]
UpgradeRequired(String)
426 Upgrade Required [RFC7231, Section 6.5.15]
PreconditionRequired(String)
428 Precondition Required [RFC6585]
TooManyRequests(String)
429 Too Many Requests [RFC6585]
RequestHeaderFieldsTooLarge(String)
431 Request Header Fields Too Large [RFC6585]
451 Unavailable For Legal Reasons [RFC7725]
InternalServerError(String)
500 Internal Server Error [RFC7231, Section 6.6.1]
NotImplemented(String)
501 Not Implemented [RFC7231, Section 6.6.2]
BadGateway(String)
502 Bad Gateway [RFC7231, Section 6.6.3]
503 Service Unavailable [RFC7231, Section 6.6.4]
GatewayTimeout(String)
504 Gateway Timeout [RFC7231, Section 6.6.5]
HttpVersionNotSupported(String)
505 HTTP Version Not Supported [RFC7231, Section 6.6.6]
VariantAlsoNegotiates(String)
506 Variant Also Negotiates [RFC2295]
InsufficientStorage(String)
507 Insufficient Storage [RFC4918]
LoopDetected(String)
508 Loop Detected [RFC5842]
NotExtended(String)
510 Not Extended [RFC2774]
NetworkAuthenticationRequired(String)
511 Network Authentication Required [RFC6585]
Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for ApiRes<T>where
T: Deserialize<'de> + Serialize,
impl<'de, T> Deserialize<'de> for ApiRes<T>where
T: Deserialize<'de> + Serialize,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T: Serialize> Responder for ApiRes<T>
impl<T: Serialize> Responder for ApiRes<T>
type Body = BoxBody
Source§fn respond_to(self, _req: &HttpRequest) -> HttpResponse
fn respond_to(self, _req: &HttpRequest) -> HttpResponse
HttpResponse.