diff --git a/src/imp.rs b/src/imp.rs index 9a58dab..a6fcfa2 100644 --- a/src/imp.rs +++ b/src/imp.rs @@ -75,7 +75,7 @@ impl BehaviourBuilder { /// Trait to be used by implementors of imp bots to supply their custom event handling /// the handle function is called after the default imp automatic event handling has run on each new event pub trait EventHandler { - fn handle(&self, cwtch: &dyn CwtchLib, profile: Option<&Profile>, event: CwtchEvent); + fn handle(&mut self, cwtch: &dyn CwtchLib, profile: Option<&Profile>, event: CwtchEvent); } /// Cwtch bot @@ -102,7 +102,7 @@ impl Imp { } /// The main event loop handler for the bot, supply your own customer handler to handle events after the imp's automatic handling has processed the event - pub fn event_loop(&mut self, handler: Box) { + pub fn event_loop(&mut self, handler: &mut T) where T : EventHandler { let mut initialized: bool = false; loop {