1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/// Returns the bubble sorted version of the input
///
/// This function takes a list as a reference and returns either the sorted list as a `Vec<i32>` or an error.
///
/// # Examples
///
/// Basic usage:
/// ```
/// let result = algorithmz::sorting::bubble_sort(&[2,1,4,3,5]).unwrap();
/// assert_eq!(result, [1,2,3,4,5]);
/// ```
///
/// With match statement:
/// ```
/// use algorithmz::sorting::bubble_sort;
/// let my_list = [1,3,2,5,4];
/// match bubble_sort(&my_list) {
/// Err(e) => eprintln!("The error was: {}", e),
/// Ok(nums) => println!("The result was: {:?}", nums),
/// }
/// ```