Keats / validator

Simple validation for Rust structs
MIT License
1.97k stars 141 forks source link

Start implementing range support for NonZero types #270

Open timvisee opened 1 year ago

timvisee commented 1 year ago

Fixes https://github.com/Keats/validator/issues/269.

Implements support for using the range validator on NonZero types from the standard library such as NonZeroU64.

This is just a start and is definitely not ready to be merged. I'm sure some important edge cases are missed. I'm not familiar with this codebase.

I'd like to know if implementing something like this is in-scope before putting more effort into it.

Keats commented 1 year ago

Hold on, there is https://github.com/Keats/validator/pull/262 close to being merged so it would be better to check on that branch

timvisee commented 1 year ago

Hold on, there is #262 close to being merged so it would be better to check on that branch

Thanks for the heads up! I'll try to rebase or recreate once it's merged.

pintariching commented 1 year ago

Look at the ValidateRange trait of the next branch of #262. That's where you can implement all the traits, I forgot what they're called.

timvisee commented 1 year ago

Look at the ValidateRange trait of the next branch of #262. That's where you can implement all the traits, I forgot what they're called.

Fantastic. Much better interface to implement. I'll stall efforts on this until it is merged to prevent constant conflicts.

Keats commented 6 months ago

Can you update the PR if you have time? I'm planning to release the changes soonish

Keats commented 6 months ago

It's merged and released as 0.17 now

GrantGryczan commented 6 days ago

I know this PR needs to be updated anyway, but just for the record, it looks like this is missing NonZeroUsize.