Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent components and swaps them if they are in the wrong order. More efficient algorithms such as timsort, or merge sort are used by the sorting library build into popular programming languages such as Python and Java.

The only significant advantage that bubble sort has over most other algorithms, even quicksort, but not insertion sort, is that the ability to detect that the list is sorted efficiently is build into the algorithm. Therefore, bubble sort is not a practical sorting algorithm.

```
pub fn bubble_sort<T: Ord>(arr: &mut [T]) {
for i in 0..arr.len() {
for j in 0..arr.len() - 1 - i {
if arr[j] > arr[j + 1] {
arr.swap(j, j + 1);
}
}
}
}
```