Use FnMut for registering client handlers

This commit is contained in:
panicbit 2018-03-26 08:53:38 +02:00
parent 9f15041d01
commit e514c97688

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)