Skip to content

Instantly share code, notes, and snippets.

@SethDusek
Created July 25, 2020 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SethDusek/05c14b9e0de93229cd0d047c9c65f9c4 to your computer and use it in GitHub Desktop.
Save SethDusek/05c14b9e0de93229cd0d047c9c65f9c4 to your computer and use it in GitHub Desktop.
struct Foo {
x: i32,
}
fn main() {
let mut foo = Foo { x: 42 };
let x = &mut foo.x;
*x = 13;
let y = foo;
println!("{}", y.x); // -> 42; expected result: 13
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment