Could you please write me Rust code that takes ownership of an array of integers and sorts them in ascending order?
user
Sure, here's an implementation in Rust:

```
fn sort_ascending(arr: &mut [i32]) {
    arr.sort_unstable();
}

fn main() {
    let mut arr = [5, 2, 4, 1, 3];
    sort_ascending(&mut arr);
    println!("{:?}", arr);
}
```

This code sorts the array arr in place using the sort_unstable method. The sort_unstable method sorts the slice in place and may not preserve the order of equal elements.
assistant
do it in descending order
user
fn main() {
    let mut numbers = vec![4, 1, 3, 2];

    numbers.sort_by(|a, b| b.cmp(a));

    println!("{:?}", numbers);
}
assistant