Skip to content

Commit

Permalink
Generalize Reply impl for Box<dyn Reply>
Browse files Browse the repository at this point in the history
We had a case where we were boxing up replies, and needed them to impl `Send + Sync` to use in other code. `Box<dyn Reply + Send + Sync>` unfortunately doesn't implement `Reply`, because the impl is too specific. This generalizes the impl of `Reply` to include any `Box<T>` where `T: Reply + ?Sized`.
  • Loading branch information
mikeyhew committed Feb 18, 2020
1 parent 6c4283a commit a05222f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/reply.rs
Expand Up @@ -289,7 +289,7 @@ pub trait Reply: BoxedReply + Send {
*/
}

impl Reply for Box<dyn Reply> {
impl<T: Reply + ?Sized> Reply for Box<T> {
fn into_response(self) -> Response {
self.boxed_into_response(Internal)
}
Expand Down

0 comments on commit a05222f

Please sign in to comment.