trait Responder{
}
struct App;
impl App {
fn new() -> Self {
Self {}
}
fn service<T, B>(&self, routes: T) -> Self where T: Fn()-> impl Responder {
Self {}
}
}
struct Routes {
data:String,
}
impl Responder for Routes{
}
fn routes() -> impl Responder {
Routes {
data: "Hello".to_string()
}
}
fn main() {
// let new_routes = routes;
App::new().service(routes);
}
How do i pass a function a parameter that return "impl Trait" or in my case "impl Responder".
The error that it gives is: impl Trait
not allowed outside of function and inherent method return types.