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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! # Mandatory readme
//!
//! This crate provides various different sorting algorithms both implemented directly on 
//! any `Vec` implementing certain things and also as standalone functions.
//! 
//! # Examples
//!
//! Using the trait implementations:
//! 
//! ```rust
//! use sort_it::prelude::*;
//! 
//! fn main() {
//!     let mut v = vec![9, 8, 7, 6, 5, 4, 3, 2, 1];
//!     
//!     println!("original v: {:?}", v.clone()); 
//!     
//!     v.gnome_sort(); // sorts `v` via gnome sort (with the trait implementation).
//!     
//!     println!("sorted v: {:?}", v);
//! }
//! ```
//!
//! Without using the trait implementations:
//! 
//! ```rust
//! use sort_it::prelude::*;
//! use rand::prelude::*;
//! 
//! fn main() {
//!     let mut rng = rand::thread_rng();
//!     
//!     let mut v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];
//! 
//!     v.shuffle(&mut rng); // randomly shuffles `v`.
//!     
//!     let s = merge_sort(v.clone()); // returns a sorted copy of `v` via merge sort (without the trait implementation).
//!     
//!     println!("v: {:?}, s: {:?}", v, s);
//! }
//! ```
//! 
//! # Implemented sorting algorithms:
//! 
//! * Bogosort
//! * Bubble Sort
//! * Gnome Sort
//! * Insertion Sort
//! * Merge Sort
//! * Selection Sort
//! * Slowsort
//! * Stooge Sort
//! 
//! Have fun sorting things in different ways.

#[cfg(test)]
mod tests;

pub mod algorithms;

pub mod prelude {
    pub use crate::algorithms::*;
}