Enum Ricksponse

Source
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§

§

Data

Fields

§data: T
§http_code: Option<u16>
§message: Option<String>
§

Error

Fields

§http_code: Option<u16>
§message: Option<String>

Implementations§

Source§

impl<T> Ricksponse<T>

Source

pub fn http_code(&mut self, code: u16)

Source

pub fn message(&mut self, msg: String)

Source

pub fn get_or_with_data(&mut self, data: T) -> &mut T

Source

pub fn new(t: T) -> Self

Source

pub fn new_with_http(t: T, http: u16) -> Self

Source

pub fn new_with_http_and_message(t: T, http: u16, message: &str) -> Self

Source§

impl<T> Ricksponse<T>

Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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()
);
Source

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,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Display for Ricksponse<T>
where T: Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Serialize + HateoasResource + DeserializeOwned + Default> From<Hateoas<T>> for Ricksponse<Hateoas<T>>

Source§

fn from(r: Hateoas<T>) -> Self

Converts to this type from the input type.
Source§

impl<T, E: DebuggableAny> From<Result<T, E>> for Ricksponse<T>

Source§

fn from(r: Result<T, E>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Ricksponse<T>> for HttpResponseBuilder

Source§

fn from(r: Ricksponse<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Ricksponse<T>> for Result<T, Option<Box<dyn DebuggableAny>>>

Source§

fn from(r: Ricksponse<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> FromRequest for Ricksponse<T>

§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 Error = Error

The associated error which can be returned.
Source§

type Future = PayloadFuture<T, T, Ricksponse<T>>

Future that resolves to a Self. Read more
Source§

fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future

Create a Self from request parts asynchronously.
Source§

fn extract(req: &HttpRequest) -> Self::Future

Create a Self from request head asynchronously. Read more
Source§

impl<T: Serialize> Responder for Ricksponse<T>

Source§

type Body = BoxBody

Source§

fn respond_to(self, req: &HttpRequest) -> HttpResponse<Self::Body>

Convert self to HttpResponse.
Source§

fn customize(self) -> CustomizeResponder<Self>
where Self: Sized,

Wraps responder to allow alteration of its response. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .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
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .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
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,