mirror of
https://github.com/Djeeberjr/fw-anwesenheit.git
synced 2025-08-02 06:44:17 +00:00
32 lines
548 B
Rust
32 lines
548 B
Rust
extern crate alloc;
|
|
|
|
use super::TallyID;
|
|
use alloc::collections::BTreeMap;
|
|
use alloc::string::String;
|
|
|
|
pub struct Name {
|
|
pub first: String,
|
|
pub last: String,
|
|
}
|
|
|
|
pub struct IDMapping {
|
|
id_map: BTreeMap<TallyID, Name>,
|
|
}
|
|
|
|
impl IDMapping {
|
|
pub fn new() -> Self {
|
|
IDMapping {
|
|
id_map: BTreeMap::new(),
|
|
}
|
|
}
|
|
|
|
pub fn map(&self, id: &TallyID) -> Option<&Name> {
|
|
self.id_map.get(id)
|
|
}
|
|
|
|
pub fn add_mapping(&mut self, id: TallyID, name: Name) {
|
|
self.id_map.insert(id, name);
|
|
}
|
|
}
|
|
|