Created
June 21, 2019 00:54
-
-
Save rust-play/f4fa56c682590a8a92833edb9195e663 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(unused)] | |
struct A { | |
b: usize, | |
c: Vec<isize>, | |
} | |
impl A { | |
fn e(mut self: &mut Self) { | |
let A { | |
b, | |
c: ref mut d, | |
} = &mut self; | |
d.push(3); | |
self.c.push(4) | |
} | |
} | |
fn main() { | |
let mut a = &mut A { | |
b: 1, | |
c: vec![2], | |
}; | |
a.e(); | |
println!("{:?}", a.c); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment