-
Notifications
You must be signed in to change notification settings - Fork 29
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
Abstract from Regex in pattern validator and add support for regex-lite #57
Conversation
f613346
to
eca45ae
Compare
Sorry, haven't had time to properly look at this until now. My immediate reaction is that I'm not sure if I want to support that exact use-case, because it means testing all patterns against both That being said, I would be open to changing the Here's my very rough idea of how this could work:
If you wanted to use |
The original motivation for this change is to allow using regex_lite instead of regex crate.
Done, but I’ll recheck it tomorrow. |
1ac626a
to
fb12167
Compare
I’ve updated the documentation; it should be ready now. Just note that the new |
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.
LGTM, thanks!
Published in |
The last commit makes
regex-lite
an equivalent alternative toregex
and allows to drop dependency on theregex
crate whenregex-lite
is enabled. However, since Cargo features are awfully limited and clumsy, it’s quite ugly. I don’t suppose you would accept such change (the last commit), so I leave it here only as a demonstration.I believe it’s quite useful even without the ability to avoid pulling
regex
into the dependency graph, because if it’s not used (i.e. the user avoids using the pattern validator with string literals), the compiler will remove it when using LTO.