-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improved case macro #31
base: master
Are you sure you want to change the base?
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.
Apologies for an inexcusably late review. I find it extremely repulsive to read advanced macro_rules!
code like this one, although it's absolutely not your fault.
The tests look fine at first glance, but I'll need to scrutinize them once more.
If you're out of resources right now, I can make the changes. Let me know if you can address my review suggestions at the moment.
src/lib.rs
Outdated
/// You can also go with even more complexity and write a syntax similar to rusts pattern matching | ||
/// system: |
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 this description to be more formal. For example, the first bullet point doesn't show whether this pattern can be used like Enum::MyVariant(SecondEnum::MyVariant1, SecondEnum::MyVariant2)
, and same for the other points.
/// | ||
/// It's recursive, so on every parameter you can insert a new struct, tuple struct, enum variant or | ||
/// anything else. | ||
/// |
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.
In the examples below, we should add at least one (simple) example demonstrating the new functionality you're adding.
My pc is currently in repair, so i physically cant make the changes until it is done, which should happen soon enough |
Inspired by this message.
Although the code for
case!
was fully rewritten, there are no breaking changes!The goal was to make the
case!
pattern matching the same as the rust pattern matching, and I think it's pretty close fordptree
purposes!Sad that it's almost impossible to infer the type of
None
, but it's fineI think the tests cover all of the new use cases