chore: cleanup dead code in category.rs
This commit is contained in:
@ -105,31 +105,10 @@ impl Category {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn item_by_name(&self, name: &str) -> Option<&Item> {
|
|
||||||
// self.items.get(name)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn item_index(&self, name: &str) -> Option<usize> {
|
|
||||||
// self.items.get_index_of(name)
|
|
||||||
// }
|
|
||||||
|
|
||||||
/// Returns item names in order, grouped hierarchically
|
/// Returns item names in order, grouped hierarchically
|
||||||
pub fn ordered_item_names(&self) -> Vec<&str> {
|
pub fn ordered_item_names(&self) -> Vec<&str> {
|
||||||
self.items.keys().map(|s| s.as_str()).collect()
|
self.items.keys().map(|s| s.as_str()).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns unique group names in insertion order, derived from item.group fields.
|
|
||||||
pub fn top_level_groups(&self) -> Vec<&str> {
|
|
||||||
let mut seen = Vec::new();
|
|
||||||
for item in self.items.values() {
|
|
||||||
if let Some(g) = &item.group {
|
|
||||||
if !seen.contains(&g.as_str()) {
|
|
||||||
seen.push(g.as_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
seen
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
Reference in New Issue
Block a user