imap::extensions::idle

Struct Handle

Source
pub struct Handle<'a, T: Read + Write> { /* private fields */ }
Expand description

Handle allows a client to block waiting for changes to the remote mailbox.

The handle blocks using the IDLE command specificed in RFC 2177 until the underlying server state changes in some way. While idling does inform the client what changes happened on the server, this implementation will currently just block until anything changes, and then notify the

Note that the server MAY consider a client inactive if it has an IDLE command running, and if such a server has an inactivity timeout it MAY log the client off implicitly at the end of its timeout period. Because of that, clients using IDLE are advised to terminate the IDLE and re-issue it at least every 29 minutes to avoid being logged off. Handle::wait_keepalive does this. This still allows a client to receive immediate mailbox updates even though it need only “poll” at half hour intervals.

As long as a Handle is active, the mailbox cannot be otherwise accessed.

Implementations§

Source§

impl<'a, T: Read + Write + 'a> Handle<'a, T>

Source

pub fn wait(self) -> Result<()>

Block until the selected mailbox changes.

Source§

impl<'a, T: SetReadTimeout + Read + Write + 'a> Handle<'a, T>

Source

pub fn set_keepalive(&mut self, interval: Duration)

Set the keep-alive interval to use when wait_keepalive is called.

The interval defaults to 29 minutes as dictated by RFC 2177.

Source

pub fn wait_keepalive(self) -> Result<()>

Block until the selected mailbox changes.

This method differs from Handle::wait in that it will periodically refresh the IDLE connection, to prevent the server from timing out our connection. The keepalive interval is set to 29 minutes by default, as dictated by RFC 2177, but can be changed using Handle::set_keepalive.

This is the recommended method to use for waiting.

Source

pub fn wait_timeout(self, timeout: Duration) -> Result<()>

👎Deprecated: use wait_with_timeout instead

Block until the selected mailbox changes, or until the given amount of time has expired.

Source

pub fn wait_with_timeout(self, timeout: Duration) -> Result<WaitOutcome>

Block until the selected mailbox changes, or until the given amount of time has expired.

Trait Implementations§

Source§

impl<'a, T: Debug + Read + Write> Debug for Handle<'a, T>

Source§

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

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

impl<'a, T: Read + Write + 'a> Drop for Handle<'a, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for Handle<'a, T>

§

impl<'a, T> RefUnwindSafe for Handle<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Handle<'a, T>
where T: Send,

§

impl<'a, T> !Sync for Handle<'a, T>

§

impl<'a, T> Unpin for Handle<'a, T>

§

impl<'a, T> !UnwindSafe for Handle<'a, T>

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 = 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.