Crate elements_frequency[−][src]
Expand description
elements frequency
Finds frequency table of the unique elements present in the list. In the table the elements come in “First come first serve” manner, namingly the order they appear in the list.
This lbrary can work with any types that implement Clone.
So it is expected to work with Strings, slices, integers etc.
Quick Example
use elements_frequency::{Row, Elements}; let list = vec!["hi", "who", "me", "who", "me"]; let mut elements = Elements::new(&list); let frequency_table = elements .hash_couple() .update_order() .result(); println!("{:?}", frequency_table); // // [ // Row { element: "hi", frequency: 1 }, // Row { element: "who", frequency: 2 }, // Row { element: "me", frequency: 2 }, // ] //
Structs
This struct holds 3 fields:
1.list: The list itself
2. couple_hash: Elements hashed to their frequency.
they may come unordered when iterated over.
3. ordered_table: This field holds the ordered frequency table.
This struct acts like rows in frequency table, and holds 2 fields, the element and its frequency.