Method `mul` has an incompatible type for trait
问题 I'm creating a simple matrix struct in Rust and I'm trying to implement some basic operator methods: use std::ops::Mul; struct Matrix { cols: i32, rows: i32, data: Vec<f32>, } impl Matrix { fn new(cols: i32, rows: i32, data: Vec<f32>) -> Matrix { Matrix { cols: cols, rows: rows, data: data, } } } impl Mul<f32> for Matrix { type Output = Matrix; fn mul(&self, m: f32) -> Matrix { let mut new_data = Vec::with_capacity(self.cols * self.rows); for i in 0..self.cols * self.rows { new_data[i] = self