I have the following struct that works fine:
pub struct Pattern {
pub regex: &'static str,
pub view: Fn (Request) -> Response,
}
But I'd like to change view to accept any type that implements Renderable (trait constraint). I was expecting to make it work this way:
pub struct Pattern {
pub regex: &'static str,
pub view: Fn <T: Renderable> (Request) -> T,
}
But no luck. Any ideas?