Skip to content

Commit

Permalink
fix(middleware): satisfy lifetime requirements for RFC 1214
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryman committed Sep 7, 2015
1 parent 3a3fc6f commit 7b7742c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub trait ErrorHandler<D>: Send + 'static + Sync {
fn handle_error(&self, &mut NickelError<D>, &mut Request<D>) -> Action;
}

impl<D> ErrorHandler<D> for fn(&mut NickelError<D>, &mut Request<D>) -> Action {
impl<D: 'static> ErrorHandler<D> for fn(&mut NickelError<D>, &mut Request<D>) -> Action {
fn handle_error(&self, err: &mut NickelError<D>, req: &mut Request<D>) -> Action {
(*self)(err, req)
}
Expand All @@ -43,7 +43,7 @@ pub struct MiddlewareStack<D> {
error_handlers: Vec<Box<ErrorHandler<D> + Send + Sync>>
}

impl<D> MiddlewareStack<D> {
impl<D: 'static> MiddlewareStack<D> {
pub fn add_middleware<T: Middleware<D>> (&mut self, handler: T) {
self.handlers.push(Box::new(handler));
}
Expand Down

0 comments on commit 7b7742c

Please sign in to comment.