Hi,

when compiling following code I get following error:
use std::num;
struct vec2d { a:f32, b:f32 }
impl num::Zero for vec2d {
    fn zero() -> vec2d {
        vec2d{a:0.0, b:0.0}
    }

    fn is_zero(&self) -> bool {
        self.a==0.0 && self.b==0.0
    }
}



test.rs:4:1: 12:2 error: failed to find an implementation of trait
std::ops::Add<vec2d,vec2d> for vec2d
test.rs:4 impl num::Zero for vec2d {
test.rs:5     fn zero() -> vec2d {
test.rs:6         vec2d{a:0.0, b:0.0}
test.rs:7     }
test.rs:8
test.rs:9     fn is_zero(&self) -> bool {


Would you know why the Add trait seems to be a requirement for implementing
the zero trait.

cheers,

Rémi
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to