Enum 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

Fields

§keyword: String
§

AllInThreadHaveKeyword

Fields

§keyword: String
§

SomeInThreadHaveKeyword

Fields

§keyword: String
§

Cc

Implementations§

Source§

impl Comparator

Source

pub fn received_at() -> Comparator<Comparator>

Source

pub fn size() -> Comparator<Comparator>

Source

pub fn from() -> Comparator<Comparator>

Examples found in repository?
examples/messages.rs (line 78)
33async fn messages() {
34    // Connect to the JMAP server using Basic authentication
35    let client = Client::new()
36        .credentials(("john@example.org", "secret"))
37        .connect("https://jmap.example.org")
38        .await
39        .unwrap();
40
41    // Query mailboxes to obtain Inbox and Trash folder id
42    let inbox_id = client
43        .mailbox_query(
44            mailbox::query::Filter::role(Role::Inbox).into(),
45            None::<Vec<_>>,
46        )
47        .await
48        .unwrap()
49        .take_ids()
50        .pop()
51        .unwrap();
52    let trash_id = client
53        .mailbox_query(
54            mailbox::query::Filter::role(Role::Trash).into(),
55            None::<Vec<_>>,
56        )
57        .await
58        .unwrap()
59        .take_ids()
60        .pop()
61        .unwrap();
62
63    // Import message into inbox
64    client
65        .email_import(TEST_MESSAGE.to_vec(), [&inbox_id], ["$draft"].into(), None)
66        .await
67        .unwrap();
68
69    // Query mailbox
70    let email_id = client
71        .email_query(
72            Filter::and([
73                email::query::Filter::subject("test"),
74                email::query::Filter::in_mailbox(&inbox_id),
75                email::query::Filter::has_keyword("$draft"),
76            ])
77            .into(),
78            [email::query::Comparator::from()].into(),
79        )
80        .await
81        .unwrap()
82        .take_ids()
83        .pop()
84        .unwrap();
85
86    // Fetch message
87    let email = client
88        .email_get(
89            &email_id,
90            [Property::Subject, Property::Preview, Property::Keywords].into(),
91        )
92        .await
93        .unwrap()
94        .unwrap();
95    assert_eq!(email.preview().unwrap(), "This is a test.");
96    assert_eq!(email.subject().unwrap(), "Testing JMAP client");
97    assert_eq!(email.keywords(), ["$draft"]);
98
99    // Remove the $draft keyword
100    client
101        .email_set_keyword(&email_id, "$draft", false)
102        .await
103        .unwrap();
104
105    // Replace all keywords
106    client
107        .email_set_keywords(&email_id, ["$seen", "$important"])
108        .await
109        .unwrap();
110
111    // Move the message to the Trash folder
112    client
113        .email_set_mailboxes(&email_id, [&trash_id])
114        .await
115        .unwrap();
116
117    // Destroy the e-mail
118    client.email_destroy(&email_id).await.unwrap();
119}
Source

pub fn to() -> Comparator<Comparator>

Source

pub fn cc() -> Comparator<Comparator>

Source

pub fn subject() -> Comparator<Comparator>

Source

pub fn sent_at() -> Comparator<Comparator>

Source

pub fn has_keyword(keyword: impl Into<String>) -> Comparator<Comparator>

Source

pub fn all_in_thread_have_keyword( keyword: impl Into<String>, ) -> Comparator<Comparator>

Source

pub fn some_in_thread_have_keyword( keyword: impl Into<String>, ) -> Comparator<Comparator>

Trait Implementations§

Source§

impl Clone for Comparator

Source§

fn clone(&self) -> Comparator

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Comparator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for Comparator

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T