如何向变量添加大括号以防止它被匹配借用(拥有?)?

时间:2017-05-07 11:28:27

标签: rust scoping borrowing

我正在尝试理解一个implementation of a binary tree in Rust而我无法围绕locate_mut函数中的一些范围魔术:

match {anchor} {
    &mut Some(ref mut node) if key != node.value.key() => {
        anchor = if key < node.value.key() {
            &mut node.left
        } else {
            &mut node.right
        }
    },
    other @ &mut Some(_) |
    other @ &mut None => return other
}

0 个答案:

没有答案