finished moving out render_state

This commit is contained in:
2026-01-19 18:00:24 -05:00
parent 79813db3ba
commit 06dd015092
26 changed files with 497 additions and 221 deletions

View File

@@ -1,5 +1,5 @@
use crate::{
Event, EventCtx, EventLike, EventManager, IdLike, UiRsc, Widget, WidgetEventFn, WeakWidget,
Event, EventCtx, EventLike, EventManager, IdLike, UiRsc, WeakWidget, Widget, WidgetEventFn,
};
pub trait HasState: 'static {
@@ -14,7 +14,7 @@ pub trait HasEvents: Sized + UiRsc + HasState {
&mut self,
id: WeakWidget<W>,
event: E,
f: impl WidgetEventFn<Self, <E::Event as Event>::Data, W>,
f: impl for<'a> WidgetEventFn<Self, <E::Event as Event>::Data<'a>, W>,
) {
self.events_mut().register(id, event, f);
}
@@ -24,7 +24,7 @@ pub trait RunEvents: HasEvents {
fn run_event<E: EventLike>(
&mut self,
id: impl IdLike,
data: <E::Event as Event>::Data,
data: <E::Event as Event>::Data<'_>,
state: &mut Self::State,
) {
let f = self.events_mut().get_type::<E>().run_fn(id);