diff options
Diffstat (limited to 'melib/src/thread.rs')
-rw-r--r-- | melib/src/thread.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/melib/src/thread.rs b/melib/src/thread.rs index 69e47705..76ed82d8 100644 --- a/melib/src/thread.rs +++ b/melib/src/thread.rs @@ -452,13 +452,13 @@ impl SubjectPrefix for &str { /* Sorting states. */ -#[derive(Debug, Clone, PartialEq, Copy, Deserialize, Serialize)] +#[derive(Debug, Clone, PartialEq, Eq, Copy, Deserialize, Serialize)] pub enum SortOrder { Asc, Desc, } -#[derive(Debug, Clone, PartialEq, Copy, Deserialize, Serialize)] +#[derive(Debug, Clone, PartialEq, Eq, Copy, Deserialize, Serialize)] pub enum SortField { Subject, Date, @@ -550,6 +550,10 @@ impl Thread { self.attachments > 0 } + pub fn is_empty(&self) -> bool { + self.len == 0 + } + pub fn set_snoozed(&mut self, val: bool) { self.snoozed = val; } @@ -654,6 +658,8 @@ impl PartialEq for ThreadNode { } } +impl Eq for ThreadNode {} + impl Threads { pub fn is_snoozed(&self, h: ThreadNodeHash) -> bool { self.thread_ref(self.thread_nodes[&h].group).snoozed() @@ -1442,6 +1448,10 @@ impl Threads { self.hash_set.len() } + pub fn is_empty(&self) -> bool { + self.hash_set.is_empty() + } + pub fn root_len(&self) -> usize { self.tree_index.read().unwrap().len() } |