Enum jmap_client::email::query::Comparator
source · pub enum Comparator {
ReceivedAt,
Size,
From,
To,
Subject,
SentAt,
HasKeyword {
keyword: String,
},
AllInThreadHaveKeyword {
keyword: String,
},
SomeInThreadHaveKeyword {
keyword: String,
},
Cc,
}Variants§
ReceivedAt
Size
From
To
Subject
SentAt
HasKeyword
AllInThreadHaveKeyword
SomeInThreadHaveKeyword
Cc
Implementations§
source§impl Comparator
impl Comparator
pub fn received_at() -> Comparator<Comparator>
pub fn size() -> Comparator<Comparator>
sourcepub fn from() -> Comparator<Comparator>
pub fn from() -> Comparator<Comparator>
Examples found in repository?
examples/messages.rs (line 78)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
async fn messages() {
// Connect to the JMAP server using Basic authentication
let client = Client::new()
.credentials(("john@example.org", "secret"))
.connect("https://jmap.example.org")
.await
.unwrap();
// Query mailboxes to obtain Inbox and Trash folder id
let inbox_id = client
.mailbox_query(
mailbox::query::Filter::role(Role::Inbox).into(),
None::<Vec<_>>,
)
.await
.unwrap()
.take_ids()
.pop()
.unwrap();
let trash_id = client
.mailbox_query(
mailbox::query::Filter::role(Role::Trash).into(),
None::<Vec<_>>,
)
.await
.unwrap()
.take_ids()
.pop()
.unwrap();
// Import message into inbox
client
.email_import(TEST_MESSAGE.to_vec(), [&inbox_id], ["$draft"].into(), None)
.await
.unwrap();
// Query mailbox
let email_id = client
.email_query(
Filter::and([
email::query::Filter::subject("test"),
email::query::Filter::in_mailbox(&inbox_id),
email::query::Filter::has_keyword("$draft"),
])
.into(),
[email::query::Comparator::from()].into(),
)
.await
.unwrap()
.take_ids()
.pop()
.unwrap();
// Fetch message
let email = client
.email_get(
&email_id,
[Property::Subject, Property::Preview, Property::Keywords].into(),
)
.await
.unwrap()
.unwrap();
assert_eq!(email.preview().unwrap(), "This is a test.");
assert_eq!(email.subject().unwrap(), "Testing JMAP client");
assert_eq!(email.keywords(), ["$draft"]);
// Remove the $draft keyword
client
.email_set_keyword(&email_id, "$draft", false)
.await
.unwrap();
// Replace all keywords
client
.email_set_keywords(&email_id, ["$seen", "$important"])
.await
.unwrap();
// Move the message to the Trash folder
client
.email_set_mailboxes(&email_id, [&trash_id])
.await
.unwrap();
// Destroy the e-mail
client.email_destroy(&email_id).await.unwrap();
}pub fn to() -> Comparator<Comparator>
pub fn cc() -> Comparator<Comparator>
pub fn subject() -> Comparator<Comparator>
pub fn sent_at() -> Comparator<Comparator>
pub fn has_keyword(keyword: impl Into<String>) -> Comparator<Comparator>
pub fn all_in_thread_have_keyword( keyword: impl Into<String> ) -> Comparator<Comparator>
pub fn some_in_thread_have_keyword( keyword: impl Into<String> ) -> Comparator<Comparator>
Trait Implementations§
source§impl Clone for Comparator
impl Clone for Comparator
source§fn clone(&self) -> Comparator
fn clone(&self) -> Comparator
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for Comparator
impl Debug for Comparator
Auto Trait Implementations§
impl RefUnwindSafe for Comparator
impl Send for Comparator
impl Sync for Comparator
impl Unpin for Comparator
impl UnwindSafe for Comparator
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more