Allow passing index as :ident in set_general_handler macro#384
Allow passing index as :ident in set_general_handler macro#384asoderman wants to merge 1 commit intorust-osdev:masterfrom
Conversation
Freax13
left a comment
There was a problem hiding this comment.
Thanks for this pr and sorry for not reviewing this earlier!
The problem you want to solve with this seems reasonable, but I believe the current changes would introduce a breaking change and I'd like to avoid that if possible.
| ($idt:expr, $handler:ident, $idx:ident) => { | ||
| $crate::set_general_handler!($idt, $handler, $idx..=$idx); | ||
| }; |
There was a problem hiding this comment.
This match arm would overlap with match arm just below this, wouldn't it? We can match literals in the case above this because there's now way to construct a range from a single literal, so a literal always has to be a single index, but the same is not true for idents which can be individual indices as well as ranges.
|
Perhaps we could approach this from another angle: The |
Hello, please consider this small QOL change to the set_general_handler macro.
This would allow the index to be specified by a const or variable e.g.
instead of being forced to convert it to a range
I'm not sure if there's any way to make this change less repetitive by having
$idxbe either literal or ident. It might also be worth considering refactoring out the setting individual handler functionality (the$idxvariants) into its own macro and allow users to pass a$range:identto the current macro to avoid ambiguity.