1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
//pub trait Response { // fn into_json(self) -> warp::reply::Json; //} // //pub type Result<T: Response, F> = std::result::Result<T, F>; // //pub trait Conversions { // fn into_warp_result(self) -> std::result::Result<warp::reply::Json, std::convert::Infallible>; //} // //impl<T: Response, F> Conversions for Result<T, F> { // fn into_warp_result(self) -> std::result::Result<warp::reply::Json, std::convert::Infallible> { // todo!() // } //} pub trait Middleware { type Output; } impl<T, Fil: warp::Filter<Extract = (T,)>, F: Fn() -> Fil> Middleware for F { type Output = T; } #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }