pub trait Responder {
    // Required method
    fn respond_with_builder(
        self,
        builder: Builder,
        ctx: &HttpContext
    ) -> Builder;
}
Expand description

Responder defines what type can generate a response

Required Methods§

source

fn respond_with_builder(self, builder: Builder, ctx: &HttpContext) -> Builder

Consume self into a builder

struct CustomResponder(String);

impl Responder for CustomResponder {
    fn respond_with_builder(self, builder: Builder, ctx: &HttpContext) -> Builder {
        // Put the string as the response body
        builder.body(self.0)
    }
}

Implementations on Foreign Types§

source§

impl Responder for &'static [u8]

source§

impl Responder for isize

source§

impl<A: Responder, B: Responder, C: Responder, D: Responder, E: Responder> Responder for (A, B, C, D, E)

source§

impl<A: Responder, B: Responder, C: Responder, D: Responder, E: Responder, F: Responder> Responder for (A, B, C, D, E, F)

source§

impl Responder for Error

source§

impl Responder for &'static str

source§

impl<T: Responder> Responder for Option<T>

source§

impl Responder for usize

source§

impl Responder for ()

source§

impl Responder for Vec<u8>

source§

impl Responder for u64

source§

impl<T: Responder, E: Responder> Responder for Result<T, E>

source§

impl<A: Responder, B: Responder> Responder for (A, B)

source§

impl Responder for u16

source§

impl Responder for i16

source§

impl Responder for i32

source§

impl<T> Responder for Vec<T>where T: Responder,

source§

impl<A: Responder, B: Responder, C: Responder> Responder for (A, B, C)

source§

impl<T> Responder for &'static [T]where T: Responder + Clone,

source§

impl<A: Responder, B: Responder, C: Responder, D: Responder> Responder for (A, B, C, D)

source§

impl Responder for u32

source§

impl Responder for i64

source§

impl Responder for String

Implementors§

source§

impl Responder for SaphirError

source§

impl Responder for ExtError

source§

impl Responder for MultipartError

Available on crate feature multipart only.
source§

impl Responder for File

Available on crate feature file only.
source§

impl Responder for FileStream

Available on crate feature file only.
source§

impl Responder for Bytes

source§

impl Responder for Cookie<'static>

source§

impl Responder for CookieBuilder<'static>

source§

impl Responder for CookieJar

source§

impl Responder for StatusCode

source§

impl Responder for Redirect

Available on crate feature redirect only.
source§

impl Responder for Builder

source§

impl<T: Send + Sync + 'static> Responder for Ext<T>

source§

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

Available on crate feature form only.
source§

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

Available on crate feature json only.