[−][src]Trait tsukuyomi::output::Responder
A trait that abstracts the "reply" to the client.
Derivation
The custom derive Responder
is provided for reduce boilerplates around
trait implementations.
The macro has a parameter #[response(preset = "..")]
, which specifies
the path to a type that implements a trait Preset
:
use serde::Serialize; #[derive(Debug, Serialize, Responder)] #[response(preset = "Json")] struct Post { title: String, text: String, }
You can specify the additional trait bounds to type parameters
by using the parameter #[response(bound = "..")]
:
#[derive(Debug, Responder)] #[response( preset = "Json", bound = "T: Serialize", bound = "U: Serialize", )] struct CustomValue<T, U> { t: T, u: U, }
Associated Types
type Upgrade: Upgrade
The type of asynchronous object to be ran after upgrading the protocol.
type Error: Into<Error>
The error type that will be thrown by this responder.
type Respond: Respond<Upgrade = Self::Upgrade, Error = Self::Error>
The asynchronous task converted from this responder.
Required methods
Loading content...Implementors
impl<F, T, E> Responder for Oneshot<F> where
F: FnOnce(&mut Input) -> Result<T, E>,
T: IntoResponse,
E: Into<Error>,
[src]
F: FnOnce(&mut Input) -> Result<T, E>,
T: IntoResponse,
E: Into<Error>,
type Upgrade = NeverUpgrade
type Error = E
type Respond = OneshotRespond<F>
fn respond(self) -> Self::Respond
[src]
impl<L, R> Responder for Either<L, R> where
L: Responder,
R: Responder,
[src]
L: Responder,
R: Responder,
type Upgrade = Either<L::Upgrade, R::Upgrade>
type Error = Error
type Respond = EitherRespond<L::Respond, R::Respond>
fn respond(self) -> Self::Respond
[src]
impl<P> Responder for NamedFile<P> where
P: AsRef<Path> + Send + 'static,
[src]
P: AsRef<Path> + Send + 'static,
type Upgrade = NeverUpgrade
type Error = Error
type Respond = OpenNamedFile<P>
fn respond(self) -> Self::Respond
[src]
impl<R> Responder for ResponderFn<R> where
R: Respond,
[src]
R: Respond,
type Upgrade = R::Upgrade
type Error = R::Error
type Respond = R
fn respond(self) -> Self::Respond
[src]
impl<T> Responder for T where
T: IntoResponse,
[src]
T: IntoResponse,
a branket impl of Responder
for IntoResponse
s.
type Upgrade = NeverUpgrade
type Error = Never
type Respond = IntoResponseRespond<T>
fn respond(self) -> Self::Respond
[src]
impl<T, P> Responder for Rendered<T, P> where
P: Preset<T>,
[src]
P: Preset<T>,