-
Notifications
You must be signed in to change notification settings - Fork 567
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
Replace generic commands with methods on EventCtx and DelegateCtx #931
Replace generic commands with methods on EventCtx and DelegateCtx #931
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the ergonomics improvements in the multiwin
example.
Thanks for the suggestions! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to block this for a sec and try it out with runebender, and see if it's working as-is; I have some weird stuff there around menus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, one repeated doc tweak, overall I think this is a good ergonomics improvement!
); | ||
} else { | ||
const MSG: &str = "ContextMenu<T> - T must match the application state."; | ||
if cfg!(debug_assertions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this becomes a pattern we could consider a custom macro, like log_or_panic!(...)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like it if this becomes a pattern (or log_or_panic!
) as panic!
makes debugging easier due to the back trace while log::error!
does not crash the app once you ship it.
@cmyr Thanks for the review, I think I've addressed everything. |
Third part of #908 .
Replaces
NEW_WINDOW
,SET_MENU
andSHOW_CONTEXT_MENU
commands with methods onEventCtx
andDelegateCtx
.This will get rid of any generic commands which caused quite some trouble for typed selectors.
When calling any of the methods with the wrong data type, it will
panic!
in debug mode andlog::error!
in a release build.I've not added
show_context_menu
toDelegateCtx
as I could not imagine a real world usecase.Thus I had to change
multiwin
a bit to use aController
for the context menu, which seemed to be much closer to actual usage of a context menu.