1/// An extension trait for `f32`. 2pub trait F32Ext { 3 /// Linearly interpolate between `self` and `other` with parameter `t`. 4 fn lerp(self, other: f32, t: f32) -> f32; 5} 6 7impl F32Ext for f32 { 8 fn lerp(self, other: f32, t: f32) -> f32 { 9 self * (1.0 - t) + other * t 10 } 11}