trot

Crates.iotrot
lib.rstrot
version0.1.2
sourcesrc
created_at2024-05-09 11:05:41.741159
updated_at2024-05-15 04:59:35.243386
descriptionTrait library.
homepage
repositoryhttps://github.com/SilkRose/Rarity
max_upload_size
id1235034
size3,621
(SilkRose)

documentation

README

Trot

Trait library for chaining of vector operations, and for comparison for sorting.

Example usage:

Sorting a vector:

let vec = vec![2, 1, 1, 2, 0, 3].sort_vec();
println!("{:?}", vec); // [0, 1, 1, 2, 2, 3]

Deduping a vector:

let vec = vec![2, 1, 1, 0, 0, 3].dedup_vec();
println!("{:?}", vec); // [2, 1, 0, 3]

Has more functions for sorting and deduping at the same time, and extending a vector, both returning self, like the two above examples.

Comparing within a tuple:

let mut list = vec![(3, 1), (2, 2), (1, 3)];
list.sort_by(|a, b| trot::compare(&a.0, &b.0));
println!("{:?}", list); // [(1, 3), (2, 2), (3, 1)]
Commit count: 16

cargo fmt