Merge pull request #124 from panicbit/client_handler_mut_fn

Use FnMut for registering client handlers
This commit is contained in:
Aaron Weiss 2018-03-26 10:02:02 +02:00 committed by GitHub
commit bc235a2871
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -138,8 +138,8 @@ impl IrcReactor {
/// # }
/// ```
pub fn register_client_with_handler<F, U>(
&mut self, client: IrcClient, handler: F
) where F: Fn(&IrcClient, Message) -> U + 'static,
&mut self, client: IrcClient, mut handler: F
) where F: FnMut(&IrcClient, Message) -> U + 'static,
U: IntoFuture<Item = (), Error = error::IrcError> + 'static {
self.handlers.push(Box::new(client.stream().for_each(move |message| {
handler(&client, message)