feat(message_list): create message summary struct

- introduce MessageSummary struct to encapsulate message id and subject
- implement methods to set and retrieve subject, with default if missing
This commit is contained in:
Jeremiah Russell
2025-10-06 17:03:13 +01:00
committed by Jeremiah Russell
parent 65f8bf7fc5
commit a0b365a455

View File

@@ -0,0 +1,30 @@
#[derive(Debug)]
pub(crate) struct MessageSummary {
id: String,
subject: Option<String>,
}
impl MessageSummary {
pub(crate) fn new(id: &str) -> Self {
MessageSummary {
id: id.to_string(),
subject: None,
}
}
pub(crate) fn id(&self) -> &str {
&self.id
}
pub(crate) fn set_subject(&mut self, subject: &str) {
self.subject = Some(subject.to_string())
}
pub(crate) fn subject(&self) -> &str {
if let Some(s) = &self.subject {
s
} else {
"*** No Subject for Message ***"
}
}
}