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
I wanted to use the range validator for my ordered enum type.
#[derive(Clone,Debug,PartialEq,PartialOrd)]enumMyOrderedEnum{First,Second,Third,Fourth,}#[derive(Validate)]structSecondOrThird{#[validate(range( min = "MyOrderedEnum::Second", max = "MyOrderedEnum::Third")]val:MyOrderedEnum}
But I got the following error:
Validator `range` can only be used on number types but found `MyOrderedEnum` for field `val`
I noticed that this is explicitly checked with assert_has_range instead of letting the compiler check if the type implements PartialEq and PartialOrd.
I would like to know if there is any background to this or if it can be fixed.
Thank you.
The text was updated successfully, but these errors were encountered:
I wanted to use the range validator for my ordered enum type.
But I got the following error:
I noticed that this is explicitly checked with
assert_has_range
instead of letting the compiler check if the type implementsPartialEq
andPartialOrd
.I would like to know if there is any background to this or if it can be fixed.
Thank you.
The text was updated successfully, but these errors were encountered: