For example, this doesn't work.
macro_rules! Q(($T:ty, $f:expr, $name:ident) => {
struct $name {
value: $T
}
impl $name {
pure fn add(&self, other: &$name) -> $name {
$name { value: self.value + other.value }
}
}
})
Q!(i8, 8, Q8)
fn main() {
let a = Q8 { value: 4 };
let b = Q8 { value: 8 };
io::println(fmt!("Q8: %?", &a.add(&b)))
}
and gives the error,
error: type `Q8` does not implement any method in scope named `add`
io::println(fmt!("Q8: %?", &a.add(&b)))
the intended effect is something like,
should be printed to stdout.
For example, this doesn't work.
and gives the error,
the intended effect is something like,
should be printed to stdout.