From a0b365a4557549c7183cd0ab96e9fe25c87a9e92 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Mon, 6 Oct 2025 17:03:13 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(message=5Flist):=20create=20me?= =?UTF-8?q?ssage=20summary=20struct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - introduce MessageSummary struct to encapsulate message id and subject - implement methods to set and retrieve subject, with default if missing --- src/message_list/message_summary.rs | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/message_list/message_summary.rs diff --git a/src/message_list/message_summary.rs b/src/message_list/message_summary.rs new file mode 100644 index 0000000..2520d5f --- /dev/null +++ b/src/message_list/message_summary.rs @@ -0,0 +1,30 @@ +#[derive(Debug)] +pub(crate) struct MessageSummary { + id: String, + subject: Option, +} + +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 ***" + } + } +}