You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I've brought up in keyboard modifiers available alongside events #1868, keyboard modifiers should be made available at a higher level in the Event struct, to allow pattern matching on things like ctrl-click.
Currently pattern matching on no modifiers can be done in the following way:
While this works, there is still some problems. Aside from feeling awkward, I've noticed that the code still compiles if the const definition const NO_MODIFIER: Modifiers = Modifiers::empty(); is omitted; the pattern matching against NO_MODIFIER is interpreted as destructuring instead.
I've noticed that a number of newer libraries have popped up claiming to address problems with the bitflags crate. Perhaps one of these is worth considering?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
As I've brought up in keyboard modifiers available alongside events #1868, keyboard modifiers should be made available at a higher level in the Event struct, to allow pattern matching on things like ctrl-click.
Currently pattern matching on no modifiers can be done in the following way:
While this works, there is still some problems. Aside from feeling awkward, I've noticed that the code still compiles if the const definition
const NO_MODIFIER: Modifiers = Modifiers::empty();
is omitted; the pattern matching againstNO_MODIFIER
is interpreted as destructuring instead.I've noticed that a number of newer libraries have popped up claiming to address problems with the bitflags crate. Perhaps one of these is worth considering?
Beta Was this translation helpful? Give feedback.
All reactions