我会尝试翻译这段内容:
我不明白为什么会出现这个问题,也不知道该如何避免。
我尝试运行以下代码:
impl FibHeap {
fn insert(&mut self, key: int) -> () {
let new_node = Some(box create_node(key, None, None));
match self.min{
Some(ref mut t) => t.right = new_node,
None => (),
};
println!("{}",get_right(self.min));
}
}
fn get_right(e: Option<Box<Node>>) -> Option<Box<Node>> {
match e {
Some(t) => t.right,
None => None,
}
}
并且出现错误
error: cannot move out of dereference of `&mut`-pointer
println!("{}",get_right(self.min));
^
我不明白为什么会出现这个问题,也不知道该如何避免。