pub enum Ricksponse<T> {
Data {
data: T,
http_code: Option<u16>,
message: Option<String>,
},
Error {
error: Option<Box<dyn DebuggableAny>>,
http_code: Option<u16>,
message: Option<String>,
},
}Variants§
Implementations§
Source§impl<T> Ricksponse<T>
impl<T> Ricksponse<T>
pub fn http_code(&mut self, code: u16)
pub fn message(&mut self, msg: String)
pub fn get_or_with_data(&mut self, data: T) -> &mut T
pub fn new(t: T) -> Self
pub fn new_with_http(t: T, http: u16) -> Self
pub fn new_with_http_and_message(t: T, http: u16, message: &str) -> Self
Source§impl<T> Ricksponse<T>
impl<T> Ricksponse<T>
Sourcepub fn CONTINUE(t: T) -> Ricksponse<T>
pub fn CONTINUE(t: T) -> Ricksponse<T>
100 Continue [RFC7231, Section 6.2.1]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::CONTINUE("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn SWITCHING_PROTOCOLS(t: T) -> Ricksponse<T>
pub fn SWITCHING_PROTOCOLS(t: T) -> Ricksponse<T>
101 Switching Protocols [RFC7231, Section 6.2.2]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::SWITCHING_PROTOCOLS("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn PROCESSING(t: T) -> Ricksponse<T>
pub fn PROCESSING(t: T) -> Ricksponse<T>
102 Processing [RFC2518]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::PROCESSING("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn OK(t: T) -> Ricksponse<T>
pub fn OK(t: T) -> Ricksponse<T>
200 OK [RFC7231, Section 6.3.1]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::OK("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn CREATED(t: T) -> Ricksponse<T>
pub fn CREATED(t: T) -> Ricksponse<T>
201 Created [RFC7231, Section 6.3.2]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::CREATED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn ACCEPTED(t: T) -> Ricksponse<T>
pub fn ACCEPTED(t: T) -> Ricksponse<T>
202 Accepted [RFC7231, Section 6.3.3]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::ACCEPTED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn NON_AUTHORITATIVE_INFORMATION(t: T) -> Ricksponse<T>
pub fn NON_AUTHORITATIVE_INFORMATION(t: T) -> Ricksponse<T>
203 Non-Authoritative Information [RFC7231, Section 6.3.4]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::NON_AUTHORITATIVE_INFORMATION("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn NO_CONTENT(t: T) -> Ricksponse<T>
pub fn NO_CONTENT(t: T) -> Ricksponse<T>
204 No Content [RFC7231, Section 6.3.5]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::NO_CONTENT("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn RESET_CONTENT(t: T) -> Ricksponse<T>
pub fn RESET_CONTENT(t: T) -> Ricksponse<T>
205 Reset Content [RFC7231, Section 6.3.6]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::RESET_CONTENT("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn PARTIAL_CONTENT(t: T) -> Ricksponse<T>
pub fn PARTIAL_CONTENT(t: T) -> Ricksponse<T>
206 Partial Content [RFC7233, Section 4.1]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::PARTIAL_CONTENT("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn MULTI_STATUS(t: T) -> Ricksponse<T>
pub fn MULTI_STATUS(t: T) -> Ricksponse<T>
207 Multi-Status [RFC4918]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::MULTI_STATUS("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn ALREADY_REPORTED(t: T) -> Ricksponse<T>
pub fn ALREADY_REPORTED(t: T) -> Ricksponse<T>
208 Already Reported [RFC5842]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::ALREADY_REPORTED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn IM_USED(t: T) -> Ricksponse<T>
pub fn IM_USED(t: T) -> Ricksponse<T>
226 IM Used [RFC3229]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::IM_USED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn MULTIPLE_CHOICES(t: T) -> Ricksponse<T>
pub fn MULTIPLE_CHOICES(t: T) -> Ricksponse<T>
300 Multiple Choices [RFC7231, Section 6.4.1]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::MULTIPLE_CHOICES("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn MOVED_PERMANENTLY(t: T) -> Ricksponse<T>
pub fn MOVED_PERMANENTLY(t: T) -> Ricksponse<T>
301 Moved Permanently [RFC7231, Section 6.4.2]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::MOVED_PERMANENTLY("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn FOUND(t: T) -> Ricksponse<T>
pub fn FOUND(t: T) -> Ricksponse<T>
302 Found [RFC7231, Section 6.4.3]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::FOUND("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn SEE_OTHER(t: T) -> Ricksponse<T>
pub fn SEE_OTHER(t: T) -> Ricksponse<T>
303 See Other [RFC7231, Section 6.4.4]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::SEE_OTHER("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn NOT_MODIFIED(t: T) -> Ricksponse<T>
pub fn NOT_MODIFIED(t: T) -> Ricksponse<T>
304 Not Modified [RFC7232, Section 4.1]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::NOT_MODIFIED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn USE_PROXY(t: T) -> Ricksponse<T>
pub fn USE_PROXY(t: T) -> Ricksponse<T>
305 Use Proxy [RFC7231, Section 6.4.5]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::USE_PROXY("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn TEMPORARY_REDIRECT(t: T) -> Ricksponse<T>
pub fn TEMPORARY_REDIRECT(t: T) -> Ricksponse<T>
307 Temporary Redirect [RFC7231, Section 6.4.7]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::TEMPORARY_REDIRECT("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn PERMANENT_REDIRECT(t: T) -> Ricksponse<T>
pub fn PERMANENT_REDIRECT(t: T) -> Ricksponse<T>
308 Permanent Redirect [RFC7238]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::PERMANENT_REDIRECT("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn BAD_REQUEST(t: T) -> Ricksponse<T>
pub fn BAD_REQUEST(t: T) -> Ricksponse<T>
400 Bad Request [RFC7231, Section 6.5.1]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::BAD_REQUEST("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn UNAUTHORIZED(t: T) -> Ricksponse<T>
pub fn UNAUTHORIZED(t: T) -> Ricksponse<T>
401 Unauthorized [RFC7235, Section 3.1]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::UNAUTHORIZED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn PAYMENT_REQUIRED(t: T) -> Ricksponse<T>
pub fn PAYMENT_REQUIRED(t: T) -> Ricksponse<T>
402 Payment Required [RFC7231, Section 6.5.2]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::PAYMENT_REQUIRED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn FORBIDDEN(t: T) -> Ricksponse<T>
pub fn FORBIDDEN(t: T) -> Ricksponse<T>
403 Forbidden [RFC7231, Section 6.5.3]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::FORBIDDEN("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn NOT_FOUND(t: T) -> Ricksponse<T>
pub fn NOT_FOUND(t: T) -> Ricksponse<T>
404 Not Found [RFC7231, Section 6.5.4]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::NOT_FOUND("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn METHOD_NOT_ALLOWED(t: T) -> Ricksponse<T>
pub fn METHOD_NOT_ALLOWED(t: T) -> Ricksponse<T>
405 Method Not Allowed [RFC7231, Section 6.5.5]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::METHOD_NOT_ALLOWED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn NOT_ACCEPTABLE(t: T) -> Ricksponse<T>
pub fn NOT_ACCEPTABLE(t: T) -> Ricksponse<T>
406 Not Acceptable [RFC7231, Section 6.5.6]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::NOT_ACCEPTABLE("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn PROXY_AUTHENTICATION_REQUIRED(t: T) -> Ricksponse<T>
pub fn PROXY_AUTHENTICATION_REQUIRED(t: T) -> Ricksponse<T>
407 Proxy Authentication Required [RFC7235, Section 3.2]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::PROXY_AUTHENTICATION_REQUIRED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn REQUEST_TIMEOUT(t: T) -> Ricksponse<T>
pub fn REQUEST_TIMEOUT(t: T) -> Ricksponse<T>
408 Request Timeout [RFC7231, Section 6.5.7]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::REQUEST_TIMEOUT("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn CONFLICT(t: T) -> Ricksponse<T>
pub fn CONFLICT(t: T) -> Ricksponse<T>
409 Conflict [RFC7231, Section 6.5.8]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::CONFLICT("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn GONE(t: T) -> Ricksponse<T>
pub fn GONE(t: T) -> Ricksponse<T>
410 Gone [RFC7231, Section 6.5.9]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::GONE("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn LENGTH_REQUIRED(t: T) -> Ricksponse<T>
pub fn LENGTH_REQUIRED(t: T) -> Ricksponse<T>
411 Length Required [RFC7231, Section 6.5.10]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::LENGTH_REQUIRED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn PRECONDITION_FAILED(t: T) -> Ricksponse<T>
pub fn PRECONDITION_FAILED(t: T) -> Ricksponse<T>
412 Precondition Failed [RFC7232, Section 4.2]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::PRECONDITION_FAILED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn PAYLOAD_TOO_LARGE(t: T) -> Ricksponse<T>
pub fn PAYLOAD_TOO_LARGE(t: T) -> Ricksponse<T>
413 Payload Too Large [RFC7231, Section 6.5.11]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::PAYLOAD_TOO_LARGE("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn URI_TOO_LONG(t: T) -> Ricksponse<T>
pub fn URI_TOO_LONG(t: T) -> Ricksponse<T>
414 URI Too Long [RFC7231, Section 6.5.12]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::URI_TOO_LONG("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn UNSUPPORTED_MEDIA_TYPE(t: T) -> Ricksponse<T>
pub fn UNSUPPORTED_MEDIA_TYPE(t: T) -> Ricksponse<T>
415 Unsupported Media Type [RFC7231, Section 6.5.13]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::UNSUPPORTED_MEDIA_TYPE("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn RANGE_NOT_SATISFIABLE(t: T) -> Ricksponse<T>
pub fn RANGE_NOT_SATISFIABLE(t: T) -> Ricksponse<T>
416 Range Not Satisfiable [RFC7233, Section 4.4]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::RANGE_NOT_SATISFIABLE("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn EXPECTATION_FAILED(t: T) -> Ricksponse<T>
pub fn EXPECTATION_FAILED(t: T) -> Ricksponse<T>
417 Expectation Failed [RFC7231, Section 6.5.14]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::EXPECTATION_FAILED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn IM_A_TEAPOT(t: T) -> Ricksponse<T>
pub fn IM_A_TEAPOT(t: T) -> Ricksponse<T>
418 I’m a teapot [curiously not registered by IANA but RFC2324]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::IM_A_TEAPOT("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn MISDIRECTED_REQUEST(t: T) -> Ricksponse<T>
pub fn MISDIRECTED_REQUEST(t: T) -> Ricksponse<T>
421 Misdirected Request RFC7540, Section 9.1.2
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::MISDIRECTED_REQUEST("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn UNPROCESSABLE_ENTITY(t: T) -> Ricksponse<T>
pub fn UNPROCESSABLE_ENTITY(t: T) -> Ricksponse<T>
422 Unprocessable Entity [RFC4918]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::UNPROCESSABLE_ENTITY("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn LOCKED(t: T) -> Ricksponse<T>
pub fn LOCKED(t: T) -> Ricksponse<T>
423 Locked [RFC4918]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::LOCKED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn FAILED_DEPENDENCY(t: T) -> Ricksponse<T>
pub fn FAILED_DEPENDENCY(t: T) -> Ricksponse<T>
424 Failed Dependency [RFC4918]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::FAILED_DEPENDENCY("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn UPGRADE_REQUIRED(t: T) -> Ricksponse<T>
pub fn UPGRADE_REQUIRED(t: T) -> Ricksponse<T>
426 Upgrade Required [RFC7231, Section 6.5.15]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::UPGRADE_REQUIRED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn PRECONDITION_REQUIRED(t: T) -> Ricksponse<T>
pub fn PRECONDITION_REQUIRED(t: T) -> Ricksponse<T>
428 Precondition Required [RFC6585]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::PRECONDITION_REQUIRED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn TOO_MANY_REQUESTS(t: T) -> Ricksponse<T>
pub fn TOO_MANY_REQUESTS(t: T) -> Ricksponse<T>
429 Too Many Requests [RFC6585]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::TOO_MANY_REQUESTS("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn REQUEST_HEADER_FIELDS_TOO_LARGE(t: T) -> Ricksponse<T>
pub fn REQUEST_HEADER_FIELDS_TOO_LARGE(t: T) -> Ricksponse<T>
431 Request Header Fields Too Large [RFC6585]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::REQUEST_HEADER_FIELDS_TOO_LARGE("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn UNAVAILABLE_FOR_LEGAL_REASONS(t: T) -> Ricksponse<T>
pub fn UNAVAILABLE_FOR_LEGAL_REASONS(t: T) -> Ricksponse<T>
451 Unavailable For Legal Reasons [RFC7725]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::UNAVAILABLE_FOR_LEGAL_REASONS("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn INTERNAL_SERVER_ERROR(t: T) -> Ricksponse<T>
pub fn INTERNAL_SERVER_ERROR(t: T) -> Ricksponse<T>
500 Internal Server Error [RFC7231, Section 6.6.1]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::INTERNAL_SERVER_ERROR("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn NOT_IMPLEMENTED(t: T) -> Ricksponse<T>
pub fn NOT_IMPLEMENTED(t: T) -> Ricksponse<T>
501 Not Implemented [RFC7231, Section 6.6.2]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::NOT_IMPLEMENTED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn BAD_GATEWAY(t: T) -> Ricksponse<T>
pub fn BAD_GATEWAY(t: T) -> Ricksponse<T>
502 Bad Gateway [RFC7231, Section 6.6.3]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::BAD_GATEWAY("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn SERVICE_UNAVAILABLE(t: T) -> Ricksponse<T>
pub fn SERVICE_UNAVAILABLE(t: T) -> Ricksponse<T>
503 Service Unavailable [RFC7231, Section 6.6.4]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::SERVICE_UNAVAILABLE("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn GATEWAY_TIMEOUT(t: T) -> Ricksponse<T>
pub fn GATEWAY_TIMEOUT(t: T) -> Ricksponse<T>
504 Gateway Timeout [RFC7231, Section 6.6.5]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::GATEWAY_TIMEOUT("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn HTTP_VERSION_NOT_SUPPORTED(t: T) -> Ricksponse<T>
pub fn HTTP_VERSION_NOT_SUPPORTED(t: T) -> Ricksponse<T>
505 HTTP Version Not Supported [RFC7231, Section 6.6.6]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::HTTP_VERSION_NOT_SUPPORTED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn VARIANT_ALSO_NEGOTIATES(t: T) -> Ricksponse<T>
pub fn VARIANT_ALSO_NEGOTIATES(t: T) -> Ricksponse<T>
506 Variant Also Negotiates [RFC2295]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::VARIANT_ALSO_NEGOTIATES("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn INSUFFICIENT_STORAGE(t: T) -> Ricksponse<T>
pub fn INSUFFICIENT_STORAGE(t: T) -> Ricksponse<T>
507 Insufficient Storage [RFC4918]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::INSUFFICIENT_STORAGE("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn LOOP_DETECTED(t: T) -> Ricksponse<T>
pub fn LOOP_DETECTED(t: T) -> Ricksponse<T>
508 Loop Detected [RFC5842]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::LOOP_DETECTED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn NOT_EXTENDED(t: T) -> Ricksponse<T>
pub fn NOT_EXTENDED(t: T) -> Ricksponse<T>
510 Not Extended [RFC2774]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::NOT_EXTENDED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Sourcepub fn NETWORK_AUTHENTICATION_REQUIRED(t: T) -> Ricksponse<T>
pub fn NETWORK_AUTHENTICATION_REQUIRED(t: T) -> Ricksponse<T>
511 Network Authentication Required [RFC6585]
use ricksponse::{Ricksponse};
let mut response: Ricksponse<String> = Ricksponse::NETWORK_AUTHENTICATION_REQUIRED("test".to_string());
assert_eq!(
response.get_or_with_data("".to_string()),
&"test".to_string()
);Trait Implementations§
Source§impl<T> Debug for Ricksponse<T>where
T: Debug,
impl<T> Debug for Ricksponse<T>where
T: Debug,
Source§impl<T> Display for Ricksponse<T>where
T: Display,
impl<T> Display for Ricksponse<T>where
T: Display,
Source§impl<T: Serialize + HateoasResource + DeserializeOwned + Default> From<Hateoas<T>> for Ricksponse<Hateoas<T>>
impl<T: Serialize + HateoasResource + DeserializeOwned + Default> From<Hateoas<T>> for Ricksponse<Hateoas<T>>
Source§impl<T, E: DebuggableAny> From<Result<T, E>> for Ricksponse<T>
impl<T, E: DebuggableAny> From<Result<T, E>> for Ricksponse<T>
Source§impl<T> From<Ricksponse<T>> for HttpResponseBuilder
impl<T> From<Ricksponse<T>> for HttpResponseBuilder
Source§fn from(r: Ricksponse<T>) -> Self
fn from(r: Ricksponse<T>) -> Self
Source§impl<T> From<Ricksponse<T>> for Result<T, Option<Box<dyn DebuggableAny>>>
impl<T> From<Ricksponse<T>> for Result<T, Option<Box<dyn DebuggableAny>>>
Source§fn from(r: Ricksponse<T>) -> Self
fn from(r: Ricksponse<T>) -> Self
Source§impl<T> FromRequest for Ricksponse<T>where
T: DeserializeOwned + PayloadControl,
§Example
use actix_web::{web, App};
use serde_derive::Deserialize;
use ricksponse::Ricksponse;
use ricksponse::PayloadControl;
#[derive(Deserialize, Debug)]
struct Info {
pub username: String,
}
impl PayloadControl for Info {
const MAX_PAYLOAD_SIZE: Option<usize> = None;
const BUFFER_CAPACITY: Option<usize> = None;
}
/// deserialize `Info` from request's body
async fn index(info: Ricksponse<Info>) -> String {
format!("Welcome {:?}!", info)
}
fn main() {
let app = App::new().service(
web::resource("/index.html").route(
web::post().to(index))
);
}
impl<T> FromRequest for Ricksponse<T>where
T: DeserializeOwned + PayloadControl,
§Example
use actix_web::{web, App};
use serde_derive::Deserialize;
use ricksponse::Ricksponse;
use ricksponse::PayloadControl;
#[derive(Deserialize, Debug)]
struct Info {
pub username: String,
}
impl PayloadControl for Info {
const MAX_PAYLOAD_SIZE: Option<usize> = None;
const BUFFER_CAPACITY: Option<usize> = None;
}
/// deserialize `Info` from request's body
async fn index(info: Ricksponse<Info>) -> String {
format!("Welcome {:?}!", info)
}
fn main() {
let app = App::new().service(
web::resource("/index.html").route(
web::post().to(index))
);
}Source§type Future = PayloadFuture<T, T, Ricksponse<T>>
type Future = PayloadFuture<T, T, Ricksponse<T>>
Self. Read moreSource§fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future
fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future
Self from request parts asynchronously.Source§impl<T: Serialize> Responder for Ricksponse<T>
impl<T: Serialize> Responder for Ricksponse<T>
type Body = BoxBody
Source§fn respond_to(self, req: &HttpRequest) -> HttpResponse<Self::Body>
fn respond_to(self, req: &HttpRequest) -> HttpResponse<Self::Body>
HttpResponse.Auto Trait Implementations§
impl<T> Freeze for Ricksponse<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Ricksponse<T>
impl<T> !Send for Ricksponse<T>
impl<T> !Sync for Ricksponse<T>
impl<T> Unpin for Ricksponse<T>where
T: Unpin,
impl<T> !UnwindSafe for Ricksponse<T>
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
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.