1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// This is free and unencumbered software released into the public domain.
use imap::extensions::sort::SortCriterion;
#[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
pub enum ImapOrderBy {
/// The default server order
#[default]
None,
/// The server's received date and time
Timestamp,
/// The sender's sent date and time
Date,
/// The first From address
From,
/// The first To address
To,
/// The first Cc address
Cc,
/// The size of the message
Size,
}
impl Into<SortCriterion<'_>> for ImapOrderBy {
fn into(self) -> SortCriterion<'static> {
use ImapOrderBy::*;
match self {
None => SortCriterion::Arrival,
Timestamp => SortCriterion::Reverse(&SortCriterion::Arrival),
Date => SortCriterion::Reverse(&SortCriterion::Date),
From => SortCriterion::From,
To => SortCriterion::To,
Cc => SortCriterion::Cc,
Size => SortCriterion::Size,
}
}
}