♻️ refactor(gmail_client): move message_summary to gmail_client
- move `message_summary.rs` from `message_list` to `gmail_client` for better organization - derive `Clone` for `MessageSummary` struct
This commit is contained in:
committed by
Jeremiah Russell
parent
247f8e6b00
commit
edc27739f8
30
src/gmail_client/message_summary.rs
Normal file
30
src/gmail_client/message_summary.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
#[derive(Debug, Clone)]
|
||||
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 ***"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user