[][src]Function tao_of_rust::ch02::binding::reference

pub fn reference()

引用

Basic usage:

pub fn reference() {
    let a = [1,2,3];
    let b = &a;
    println!("{:p}", b);  // 0x7ffcbc067704
    let mut c = vec![1,2,3];
    let d = &mut c;
    d.push(4);
    println!("{:?}", d);
    let e = &42;
    assert_eq!(42, *e);
}
reference();Run