Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }

Implementations§

Source§

impl Client

Source

pub fn connect(host: &str, port: u16, tls: bool) -> Result<Client>

Source

pub fn connect_with( host: &str, port: u16, tls: bool, cutoff: &Cutoff, ) -> Result<Client>

The same, with a way to cut the connection short from another thread (mutt’s Ctrl+G).

Source

pub fn login(&mut self, user: &str, password: &str) -> Result<()>

Source

pub fn authenticate( &mut self, mechanism: &str, response_b64: &str, ) -> Result<()>

SASL AUTHENTICATE with one client response (the OAuth mechanisms): send it on the server’s first continuation; a second continuation carries an error blob, which an empty line converts into the tagged NO.

Source

pub fn list(&mut self) -> Result<Vec<Folder>>

Source

pub fn select(&mut self, mailbox: &str) -> Result<Select>

Source

pub fn uid_fetch_flags(&mut self, set: &str) -> Result<Vec<Fetched>>

UID and flags of the messages in set (e.g. 1:*).

Source

pub fn uid_fetch_headers(&mut self, set: &str) -> Result<Vec<Fetched>>

Flags, size, and the full header block, for indexing new mail.

Source

pub fn uid_fetch_full(&mut self, uid: u32) -> Result<Vec<u8>>

The complete raw message.

Source

pub fn uid_store_flags(&mut self, uid: u32, flags: Flags) -> Result<()>

Overwrite the message’s flags (deletion goes via uid_delete).

Source

pub fn uid_delete(&mut self, set: &str) -> Result<()>

Source

pub fn expunge(&mut self) -> Result<()>

Source

pub fn create_mailbox(&mut self, mailbox: &str) -> Result<()>

Folder management: CREATE, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, each a single tagged command. The server’s tagged NO/BAD becomes an error through finish.

Source

pub fn delete_mailbox(&mut self, mailbox: &str) -> Result<()>

Source

pub fn rename_mailbox(&mut self, from: &str, to: &str) -> Result<()>

Source

pub fn subscribe_mailbox(&mut self, mailbox: &str, on: bool) -> Result<()>

Source

pub fn uid_copy(&mut self, set: &str, mailbox: &str) -> Result<()>

Server-side copy into another folder ($trash before a purge).

Source

pub fn append(&mut self, mailbox: &str, flags: Flags, body: &[u8]) -> Result<()>

Source

pub fn uid_search_body(&mut self, text: &str) -> Result<Vec<u32>>

Server-side body search: UIDs whose text contains text (ASCII only; anything else needs CHARSET negotiation, so the caller falls back to matching locally).

Source

pub fn noop_changes(&mut self) -> Result<Changes>

NOOP, classifying the server’s untagged report: nothing, only new arrivals (EXISTS/RECENT), or anything else (flag changes, expunges, unknown lines) that needs a full reconciliation.

Source

pub fn supports_idle(&mut self) -> Result<bool>

True when the server advertises IDLE (RFC 2177).

Source

pub fn status_unseen(&mut self, mailbox: &str) -> Result<u32>

UNSEEN count of a mailbox (STATUS must not target the currently selected one).

Source

pub fn idle(&mut self, stop: &AtomicBool) -> Result<bool>

RFC 2177 IDLE: block until the server announces a change, stop is set (checked whenever the socket’s read timeout fires), or ~25 minutes pass; re-issue before the server’s half-hour limit. True = the mailbox changed.

Source

pub fn logout(&mut self)

Best-effort; the connection is unusable afterwards.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.