Skip to content

Instantly share code, notes, and snippets.

@SiegeLord
Created February 19, 2014 19:50
Show Gist options
  • Save SiegeLord/9100171 to your computer and use it in GitHub Desktop.
Save SiegeLord/9100171 to your computer and use it in GitHub Desktop.
Hehehe
trait MyMul<RHS, Res>
{
fn mul(&self, rhs: &RHS) -> Res;
}
impl<T: ToPrimitive> MyMul<f64, f64> for T
{
fn mul(&self, rhs: &f64) -> f64
{
self.to_f64().unwrap() * *rhs
}
}
fn interp<T: MyMul<f64, f64>>(a: &T, b: &T, alpha: f64) -> f64
{
a * alpha // wut
}
fn main()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment