How can an operator be overloaded for different RHS types and return values?
As of Rust 1.0, you can now implement this: use std::ops::Mul; #[derive(Copy, Clone, PartialEq, Debug)] struct Vector3D { x: f32, y: f32, z: f32, } // Multiplication with scalar impl Mul<f32> for Vector3D { type Output = Vector3D; fn mul(self, f: f32) -> Vector3D { Vector3D { x: self.x * f, y: self.y * f, … Read more