tasks initial impl (still working on task_on trait method)
This commit is contained in:
@@ -2,9 +2,11 @@ use crate::{
|
||||
Event, EventCtx, EventLike, EventManager, HasUi, IdLike, Widget, WidgetEventFn, WidgetRef,
|
||||
};
|
||||
|
||||
pub trait HasEvents: Sized + HasUi + 'static {
|
||||
pub trait HasState: 'static {
|
||||
type State;
|
||||
}
|
||||
|
||||
pub trait HasEvents: Sized + HasUi + HasState {
|
||||
fn events(&self) -> &EventManager<Self>;
|
||||
fn events_mut(&mut self) -> &mut EventManager<Self>;
|
||||
|
||||
@@ -18,7 +20,7 @@ pub trait HasEvents: Sized + HasUi + 'static {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait RunEvents: HasEvents + 'static {
|
||||
pub trait RunEvents: HasEvents {
|
||||
fn run_event<E: EventLike>(
|
||||
&mut self,
|
||||
id: impl IdLike,
|
||||
@@ -29,4 +31,4 @@ pub trait RunEvents: HasEvents + 'static {
|
||||
f(EventCtx { state, data }, self)
|
||||
}
|
||||
}
|
||||
impl<T: HasEvents + 'static> RunEvents for T {}
|
||||
impl<T: HasEvents> RunEvents for T {}
|
||||
|
||||
@@ -169,3 +169,5 @@ fn null_ptr<W: ?Sized>() -> *const W {
|
||||
unsafe { std::mem::transmute_copy(&[0usize; 1]) }
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<W: ?Sized> Send for WidgetRef<W> {}
|
||||
|
||||
Reference in New Issue
Block a user