Lifetime issue passing reference to hyper handler returning future

If you know all possible types, you can use an Enum. @HadrienG made a comparison between the two in this reply, there are also crates that make the enum for you but I don't know if they work when it's not a trait you made.