-
Notifications
You must be signed in to change notification settings - Fork 152
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
Use generics and macros #274
Conversation
I don't think the trait |
So for the length validator, I would like to add an option to the validator for the type of length:
So you would call it like:
What do people think? Not on this PR though, just to get some feedback while talking about it. |
And I guess we can remove all the HasLen handling if it's unused |
I don't have a strong opinion on the type of length since I'm not actually using this library anymore (I was wrapping the lib in my own validation library and My only thought is that it may be an easy way to make a mistake by forgetting to specify. Maybe having distinct choices (e.g., As I said though, I'm not using this library currently and it's probably a better idea to take the input of others. I'll update the PR to delete |
Plus a couple of clippy suggestions
PR updated. May also want to consider replacing the use of |
Yes, lazy static will be replaced later, thanks! |
* Reduce boilerplate code using generics and macros * Remove `HasLen` Plus a couple of clippy suggestions
* Reduce boilerplate code using generics and macros * Remove `HasLen` Plus a couple of clippy suggestions
This also implements #271 on next which is included in the code changes related to
HasLen
, though I don't see howHasLen
is used in this branch.Most of the code was eliminated by using generic implementations for
Option<T>
and&T
.