mod ctx; mod manager; mod rsc; pub use ctx::*; pub use manager::*; pub use rsc::*; pub trait Event: Sized + 'static + Clone { type Data<'a>: Clone = (); type State: Default = (); /// State the whole event type keeps, rather than one copy per widget. type Global: Default = (); #[allow(unused_variables)] fn should_run<'a>(&self, data: &Self::Data<'a>) -> Option> { Some(data.clone()) } /// Whether having run on this data uses up whatever triggered it, so /// nothing further should see it. #[allow(unused_variables)] fn consumes(&self, data: &Self::Data<'_>) -> bool { false } } pub trait EventLike { type Event: Event; fn into_event(self) -> Self::Event; } impl EventLike for E { type Event = Self; fn into_event(self) -> Self::Event { self } } pub trait EventFn: Fn(EventCtx, &mut Rsc) + 'static {} impl, &mut Rsc) + 'static, Data> EventFn for F { } pub trait WidgetEventFn: Fn(EventIdCtx, &mut Rsc) + 'static { } impl, &mut Rsc) + 'static, Data, W: ?Sized> WidgetEventFn for F { }