use crate::{gtk::prelude::*, model::models::*}; impl EventHandler where F: Fn(&C) + FnOnce(&C) + FnMut(&C), { pub fn new(component: C, callback: F) -> EventHandler { Self { component, callback, } } } pub trait BtnEventHandler { fn on_click(self); } impl BtnEventHandler for EventHandler where F: Fn(&C) + FnOnce(&C) + FnMut(&C) + 'static, C: ButtonExt + WidgetExt, { fn on_click(self) { self.component .connect_clicked(move |button| (self.callback)(button)); } }