我正在try 为一个简单的 struct 自动"派生"比较功能,如下所示:
#[derive(PartialEq, Eq)]
struct Vec3 {
x: f64,
y: f64,
z: f64,
}
然而,Rust 1.15.1抱怨:
error[E0277]: the trait bound `f64: std::cmp::Eq` is not satisfied
--> src/main.rs:3:5
|
3 | x: f64,
| ^^^^^^ the trait `std::cmp::Eq` is not implemented for `f64`
|
= note: required by `std::cmp::AssertParamIsEq`
我应该怎么做才能在这里导出默认实现?