Open ryanolson opened 4 months ago
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.
InputA
InputB
Is it possible to use a From trait which can access the ranges on each val to perform the transformation?
From
val
Nope, you can't access the validation rules programmatically currently
Let's say I have two objects each with a different range:
And now I want to convert
InputA
toInputB
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 eachval
to perform the transformation?