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 ***" + } + } +}