MCPcopy Index your code
hub / github.com/askanium/rustplotlib / extract_keys

Method extract_keys

src/views/vertical_bar.rs:152–164  ·  view source on GitHub ↗

Extract the list of keys to use when stacking and coloring the bars.

(data: &Vec<impl BarDatum>)

Source from the content-addressed store, hash-verified

150
151 /// Extract the list of keys to use when stacking and coloring the bars.
152 fn extract_keys(data: &Vec<impl BarDatum>) -> Vec<String> {
153 let mut keys = Vec::new();
154 let mut map = HashMap::new();
155
156 for datum in data.iter() {
157 match map.insert(datum.get_key(), 0) {
158 Some(_) => {},
159 None => keys.push(datum.get_key()),
160 }
161 }
162
163 keys
164 }
165
166 /// Add a [Bar] entry to the dataset entries list.
167 fn add_bar(&mut self, bar: Bar) {

Callers

nothing calls this directly

Calls 1

get_keyMethod · 0.80

Tested by

no test coverage detected