Skip to content

Commit

Permalink
IoHandlerExtension for Option (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw authored and bkchr committed Jan 28, 2020
1 parent 596ed3a commit 2048538
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,14 @@ impl<M: Metadata, S2: Middleware<M>> IoHandlerExtension<M> for MetaIoHandler<M,
}
}

impl<M: Metadata, T: IoHandlerExtension<M>> IoHandlerExtension<M> for Option<T> {
fn augment<S: Middleware<M>>(self, handler: &mut MetaIoHandler<M, S>) {
if let Some(x) = self {
x.augment(handler)
}
}
}

/// Simplified `IoHandler` with no `Metadata` associated with each request.
#[derive(Clone, Debug, Default)]
pub struct IoHandler<M: Metadata = ()>(MetaIoHandler<M>);
Expand Down

0 comments on commit 2048538

Please sign in to comment.