mirror of https://github.com/rwf2/Rocket.git
Reexport, implement 'Responder' for 'Either'.
This commit is contained in:
parent
0bdb6b7bc7
commit
c0564fa8dc
|
@ -159,6 +159,7 @@ mod cookies;
|
|||
#[doc(inline)] pub use crate::config::Config;
|
||||
#[doc(inline)] pub use crate::catcher::Catcher;
|
||||
#[doc(inline)] pub use crate::router::Route;
|
||||
#[doc(hidden)] pub use either::Either;
|
||||
pub use crate::request::Request;
|
||||
pub use crate::rocket::Rocket;
|
||||
pub use crate::shutdown::Shutdown;
|
||||
|
|
|
@ -297,6 +297,19 @@ impl<'r, 'o: 'r, 't: 'o, 'e: 'o, T, E> Responder<'r, 'o> for Result<T, E>
|
|||
}
|
||||
}
|
||||
|
||||
// Responds with the wrapped `Responder` in `self`, whether it is `Left` or
|
||||
/// `Right`.
|
||||
impl<'r, 'o: 'r, 't: 'o, 'e: 'o, T, E> Responder<'r, 'o> for crate::Either<T, E>
|
||||
where T: Responder<'r, 't>, E: Responder<'r, 'e>
|
||||
{
|
||||
fn respond_to(self, req: &'r Request<'_>) -> response::Result<'o> {
|
||||
match self {
|
||||
crate::Either::Left(r) => r.respond_to(req),
|
||||
crate::Either::Right(r) => r.respond_to(req),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The response generated by `Status` depends on the status code itself. The
|
||||
/// table below summarizes the functionality:
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue