Closed davidpdrsn closed 1 year ago
For validating fields or maintaining invariants.
API could be something like
#[derive(Reflect)] struct Foo { #[reflect(from_reflect_with(clamp_ratio))] ratio: f32, } fn clamp_ratio(ratio: &dyn Reflect) -> Option<f32> { Some(ratio.downcast_ref::<f32>()?.clamp(0, 1.0)) }
For validating fields or maintaining invariants.
API could be something like