It is sometimes the case that a request may want to respond with different responses types
depending on the details of the request. Sometimes this can be handled with request guards
and sometimes this can be handled by co-opting Result's responder behavior, but in a fair amount of cases it'd be convenient to define an enum with variants for all of the Responders that are possible and then have Responder automatically derived for that enum.
Feature Request
It is sometimes the case that a request may want to respond with different responses types depending on the details of the request. Sometimes this can be handled with request guards and sometimes this can be handled by co-opting
Result
's responder behavior, but in a fair amount of cases it'd be convenient to define anenum
with variants for all of the Responders that are possible and then haveResponder
automatically derived for that enum.Here are a few use examples:
Different content types:
Different objects:
Different errors - This case is especially useful when working with multiple libraries with builtin-support for rocket.