Skip to content
New issue

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

Support message sending #429

Merged
merged 12 commits into from
Dec 18, 2023
Merged

Support message sending #429

merged 12 commits into from
Dec 18, 2023

Conversation

dhardy
Copy link
Collaborator

@dhardy dhardy commented Dec 18, 2023

  • Add fn EventState::send<M: Debug + 'static>(&mut self, id: Id, msg: M) to send a type-erased message to a designated target
  • Add fn ConfigCx::push<M: Debug + 'static>(&mut self, id: Id, msg: M) to emit a type-erased message from configure/update

Currently the second method is just a wrapper around the first, but (a) there might be a distinction between "push/emit a reusable message" and "send a non-reusable message" in the future and (b) ConfigCx might gain an embedded Id for the current widget, in which case push would lose the id parameter (but send would not).

handle_messages impls: do not expect cx.last_child().is_some()

Since it's now possible to send a message, handle_messages cannot assume that a message comes from a child.

@dhardy dhardy merged commit 8961548 into master Dec 18, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant