fix message vector filling
This commit is contained in:
parent
9b144d234e
commit
3cdaacabac
@ -189,22 +189,23 @@ pub enum LogMessage {
|
||||
#[derive(Serialize)]
|
||||
pub struct MessageTranslation {
|
||||
msg_type: LogMessage,
|
||||
message: &'static str
|
||||
message: &'static str,
|
||||
}
|
||||
|
||||
impl From<&LogMessage> for MessageTranslation {
|
||||
fn from(value: &LogMessage) -> Self {
|
||||
Self { msg_type: value.clone(), message: value.into() }
|
||||
Self {
|
||||
msg_type: value.clone(),
|
||||
message: value.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl LogMessage {
|
||||
pub fn to_log_localisation_config() -> Vec<MessageTranslation> {
|
||||
let mut array = Vec::with_capacity(LogMessage::len());
|
||||
|
||||
for msg_type in LogMessage::iter() {
|
||||
array[msg_type.ordinal()] = (&msg_type).into();
|
||||
}
|
||||
array
|
||||
Vec::from_iter((0..LogMessage::len()).map(|i| {
|
||||
let msg_type = LogMessage::from_ordinal(i).unwrap();
|
||||
(&msg_type).into()
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user