IntoResponse

Trait IntoResponse 

Source
pub trait IntoResponse: Sized {
    // Required method
    fn to_response(self) -> Result<Response, CatBridgeError>;
}
Available on crate features clients or servers only.
Expand description

A blanket trait to implement into a full response.

This was mainly implemented so functions that return things like Bytes, can naturally get wrapped into a result without needing to return a result themselves.

Required Methods§

Source

fn to_response(self) -> Result<Response, CatBridgeError>

Convert an arbitrary type to a Response.

§Errors

If for whatever reason the type can’t be turned into a response.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl IntoResponse for &'static str

Source§

impl IntoResponse for &'static [u8]

Source§

impl IntoResponse for ()

Source§

impl IntoResponse for String

Source§

impl IntoResponse for Vec<u8>

Source§

impl IntoResponse for Bytes

Source§

impl IntoResponse for BytesMut

Source§

impl<OkTy: IntoResponse> IntoResponse for Result<OkTy, CatBridgeError>

Source§

impl<SomeTy: IntoResponse> IntoResponse for Option<SomeTy>

Implementors§