Skip to content

Instantly share code, notes, and snippets.

@stat
Last active November 14, 2016 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stat/d503c2f7f27b4b9159b29c163930c091 to your computer and use it in GitHub Desktop.
Save stat/d503c2f7f27b4b9159b29c163930c091 to your computer and use it in GitHub Desktop.
fn add_to_mutable_reference(x: &mut i32) {
*x +=1;
}
#[test]
fn mutable_reference_test() {
let mut x = 5;
mutable_reference(&mut x);
assert_eq!(6, x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment