Keats / validator

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

Support NonZero types #269

Open timvisee opened 1 year ago

timvisee commented 1 year ago

I'd like to see support for NonZero types from the standard library such as NonZeroU64. We'd like to use this in Qdrant.

For example:

#[derive(Debug, Validate)]
struct TestStruct {
    #[validate(range(min = 5, max = 10))]
    val: NonZeroU64,
}

Is this something that can be implemented within this crate, or is it out of scope?

I started an implementation in https://github.com/Keats/validator/pull/270.