pub trait ToF32 {
// Required method
fn to_f32(&self) -> Option<f32>;
}Expand description
Trait for converting data types to f32 for curve editing.
Implement this trait on your data enum to enable egui-keyframe integration
with GenericValue. Return None for types that
cannot be displayed as scalar curves (e.g., strings, colors, transforms).
§Example
ⓘ
impl ToF32 for MyData {
fn to_f32(&self) -> Option<f32> {
match self {
MyData::Float(f) => Some(*f),
MyData::Vec3(_) => None, // Can't display as single curve.
}
}
}