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

Pass an owned value and an egui::Ui to Plugin::run() #205

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

abey79
Copy link
Contributor

@abey79 abey79 commented Oct 28, 2024

This PR changes the API of Plugin::run() in two ways:

  • It pass an owned value of Plugin instead of a mutable reference. Based on my experience for similar APIs (e.g. Rerun's list_item), it can be very useful for implementer to have an owned value. For example it makes it possible for the plugin to carry a dyn FnOnce. This works because plugins are only ever called once. The trick to keep the trait object safe is to force the value to be wrapped in a Box. That's how things are already, so I figured this is acceptable.
  • It pass an egui::Ui instead of an egui::Painter. This enables using egui to create more complex interactions within the view, for example hover tooltips etc. (see Provide Plugin::run() with an egui:Ui #197).

Fixes #197

@podusowski podusowski merged commit 41f234a into podusowski:main Oct 28, 2024
1 check passed
@abey79 abey79 deleted the antoine/plugin-ui branch October 29, 2024 07:31
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.

Provide Plugin::run() with an egui:Ui
2 participants