Skip to content
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

min_len and max_len don't work for strings #13

Open
not-my-profile opened this issue Jan 20, 2021 · 1 comment
Open

min_len and max_len don't work for strings #13

not-my-profile opened this issue Jan 20, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@not-my-profile
Copy link

#[derive(Validate)]
struct Thing {
    #[validatron(min_len = 5)]
    pub name: String
}

fails with:

&std::string::String is not an iterator
the trait Iterator is not implemented for &std::string::String
required because of the requirements on the impl of IntoIterator for &std::string::String

@spire-ffoston
Copy link
Contributor

Thanks for raising this, I made a concious decision to not support string lengths initially to prevent any confusion with str::len() vs str::char() potentially returning different sizes.

It's on the todo list so I'll get around to adding a propper string length validator eventually.

@spire-ffoston spire-ffoston added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants