We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On::send_event
pub fn send_event<F: Event + From<ListenerInput<E>>>() -> Self {
This is the current signature of On::send_event.
However, I want to be able to quickly do things like "send an AppExit event when this button is clicked".
AppExit
I propose three related methods:
send_event
F
convert_and_send_event
send_default_event
Default
The text was updated successfully, but these errors were encountered:
Note that in some cases, I simply can't add a From impl between the event types: orphan rules block implementations on e.g. AppExit.
From
Sorry, something went wrong.
fn send_default_event<E: Event + Default>() -> Self { On::run(|mut event_writer: EventWriter<E>| { event_writer.send_default(); }) }
A working prototype of 3.
We could do all three things with a single closure version:
send_event<F: Event>(impl FnMut(E)-> F>)
send_event(move |_| my_other_event.clone())
send_event(MyEvent::from)
send_event(|_| MyEvent::default)
On::set_next_state
No branches or pull requests
This is the current signature of
On::send_event
.However, I want to be able to quickly do things like "send an
AppExit
event when this button is clicked".I propose three related methods:
send_event
: takes an event of typeF
and captures it in the closure.convert_and_send_event
: current behavior: converts E to F and sends it.send_default_event
: sends an event with theDefault
value.The text was updated successfully, but these errors were encountered: