https://doc.rust-lang.org/std/keyword.ref.html
struct Point {
x: i32,
y: i32,
}
fn main() {
let y: Option<Point> = Some(Point { x: 100, y: 200 });
match y {
Some(ref p) => println!("Co-ordinates are {},{} ", p.x, p.y), // have to use ref keyword to borrow the value
_ => panic!("no match!"),
}
y; // after using ref, you can borrow the value y.
}
标签:keyword,borrow,value,match,ref,Rust From: https://www.cnblogs.com/Answer1215/p/18052832