出错的代码:
#[derive(Debug)]
pub enum Direction {
Up = 1,
Down = -1,
Left = 2,
Right = -2,
}
impl Direction {
fn is_opposite(&self, another: &Self) -> bool {
(*self as isize) + (*another as isize) == 0
}
}
错误信息:
但是这样的代码是没问题的:
match *self {
// ...
}
我不太清楚这两者间的区别,为什么前者会引起move 或者copy?
E0507