lunar_lib/formatter/
format_table.rs1use std::collections::HashMap;
2
3#[derive(Debug, Clone, PartialEq, Eq, Default)]
5pub struct FormatTable {
6 table: HashMap<String, String>,
7}
8
9impl FormatTable {
10 pub fn new() -> Self {
12 Self {
13 table: HashMap::new(),
14 }
15 }
16
17 pub fn add_entry(&mut self, key: impl Into<String>, value: impl Into<String>) {
19 self.table
20 .insert(key.into().to_ascii_lowercase(), value.into());
21 }
22
23 pub fn add_table(&mut self, table: impl IntoIterator<Item = (String, String)>) {
25 self.table.extend(table);
26 }
27
28 pub fn table(&self) -> &HashMap<String, String> {
30 &self.table
31 }
32}