Skip to content

Instantly share code, notes, and snippets.

@boo1ean
Created January 27, 2018 19:15
Show Gist options
  • Save boo1ean/4914cbc0ce6d3f385de33266dd2398f1 to your computer and use it in GitHub Desktop.
Save boo1ean/4914cbc0ce6d3f385de33266dd2398f1 to your computer and use it in GitHub Desktop.
fn sort(list: &mut [i32]) -> &mut [i32] {
list[0] = list[1];
list
}
fn main() {
println!("Hello, world!");
let mut v = vec![1, 2, 3];
let q = sort(&mut v);
q[2] = q[1];
println!("{:?}", q);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment