You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given that AsPrimitive is lossy, I think it's quite dangerous to use for validation, even aside from NonZero. For example, minimum(&-1, 032) will return Ok!
Use-case aside -- we aren't currently implementing this for any non-primitive types, as I mentioned in #334 (comment). That's not necessarily a show-stopper, since the trait docs do mention newtypes too, but it would be an expansion from what we have now.
Background
I use async-graphql which depends on this crate on validation.
https://github.com/async-graphql/async-graphql/blob/master/src/validators/minimum.rs
I want to use NonZero Integers as well as normal integers.
Feature Request
impl AsPrimitive for NonZero integers
The text was updated successfully, but these errors were encountered: