Question: ValidateRange - programmatic inspect range
Opened this issue · 1 comments
ryanolson commented
Let's say I have two objects each with a different range:
struct InputA {
#[validate(range(min = 0, max = 1))]
pub val: f32
}
struct InputB {
#[validate(range(min = 1, max = 2))]
pub val: f32
}
And now I want to convert InputA
to InputB
by mapping the val in the range of A to the range of B with a simple linear transformation.
Is it possible to use a From
trait which can access the ranges on each val
to perform the transformation?
Keats commented
Nope, you can't access the validation rules programmatically currently