Struct elements_frequency::Elements [−][src]
pub struct Elements<'list, T> { /* fields omitted */ }Expand description
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.
Implementations
Hash the elements to its frequency.
When we iterate over the hash, the elements might come unordered. So we update their order in this method in a third list namingly frequency table.
Finally we need to chain hash_couple and update_order with
result method to get final result.
Examples
use elements_frequency::{Row, Elements}; let list = vec![-5, 11, 4, 4, -5, -7, 11]; let mut elements = Elements::new(&list); let frequency_table = elements.hash_couple().update_order().result();