Replace generic commands with methods on EventCtx and DelegateCtx#931
Replace generic commands with methods on EventCtx and DelegateCtx#931luleyleo merged 8 commits intolinebender:masterfrom luleyleo:replace-generic-commands
Conversation
xStrom
left a comment
There was a problem hiding this comment.
I like the ergonomics improvements in the multiwin example.
|
Thanks for the suggestions! |
cmyr
left a comment
There was a problem hiding this comment.
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.
cmyr
left a comment
There was a problem hiding this comment.
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.
if this becomes a pattern we could consider a custom macro, like log_or_panic!(...).
There was a problem hiding this comment.
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_MENUandSHOW_CONTEXT_MENUcommands with methods onEventCtxandDelegateCtx.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_menutoDelegateCtxas I could not imagine a real world usecase.Thus I had to change
multiwina bit to use aControllerfor the context menu, which seemed to be much closer to actual usage of a context menu.