-
Notifications
You must be signed in to change notification settings - Fork 65
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
Publicly expose either
macro as for_both
#58
Conversation
This is in preparation for the macro being publicly exported.
Crates can be renamed in `Cargo.toml`. To ensure we reference the `Either` type correctly, we need to use the special-cased `$crate` substitution. See https://veykril.github.io/tlborm/decl-macros/minutiae/import-export.html.
0a93cac
to
d4f231d
Compare
either
macro to for_both
either
macro as for_both
Hmm. Note that Rust functions and closures also allow full patterns for their arguments, not just an identifier. Also, a lot of the internal uses have We could still give that closure syntax, if desired, or even let it support patterns both ways. |
d4f231d
to
2742b1a
Compare
Friendly ping @bluss ! |
Co-authored-by: bluss <bluss@users.noreply.github.com>
I committed the syntax suggestion. I'm trying to get things together for a release... |
See commit messages for details.
Resolves #57.
I've added d4f231d at the very end as a suggestion. Happy to drop it if it is undesired. My rationale was that a closure like syntax is
a) more inuitive
b) less error prone
If we allow the user to specify patterns, they might actually run into a situation where they produce a non-exhaustive
match
. If there is consensus, I can migrate the entire crate to use closure-like syntax but I wanted to get feedback on the idea first.