log with ordinal wip

This commit is contained in:
Empire 2025-03-13 19:37:47 +01:00
parent e71351f135
commit 9296cc8c80

View File

@ -187,12 +187,20 @@ pub enum LogMessage {
}
impl LogMessage {
pub fn to_log_localisation_config() -> BTreeMap<LogMessage,&'static str> {
let mut data = BTreeMap::new();
pub fn to_log_localisation_config() -> Vec<BTreeMap<&'static str, String>> {
let mut array = Vec::with_capacity(LogMessage::len());
for msg_type in LogMessage::iter() {
let s: &'static str = msg_type.clone().into();
data.insert(msg_type, s);
//todo this should be possible without copy?
let name = msg_type.name().to_owned();
let message: &'static str = msg_type.clone().into();
let mut data = BTreeMap::new();
data.insert("msg_type", name);
data.insert("message", message.to_owned());
array[msg_type.ordinal()] = data;
}
data
array
}
}