Improve documentation around unhandled responses.
UnsolicitedResponse is not exhaustive, and open an issue if you find one that isn't handled.
This commit is contained in:
parent
ff39ebf58d
commit
9126d3c15b
2 changed files with 13 additions and 7 deletions
|
|
@ -193,8 +193,8 @@ impl<'a, T: Read + Write + 'a> Handle<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Block until the given callback returns `Stop`, or until an unhandled
|
||||
/// response arrives on the IDLE channel.
|
||||
/// Block until the given callback returns `Stop`, or until a response
|
||||
/// arrives that is not explicitly handled by [`UnsolicitedResponse`].
|
||||
pub fn wait<F>(mut self, callback: F) -> Result<()>
|
||||
where
|
||||
F: FnMut(UnsolicitedResponse) -> CallbackAction,
|
||||
|
|
@ -211,8 +211,8 @@ impl<'a, T: SetReadTimeout + Read + Write + 'a> Handle<'a, T> {
|
|||
self.keepalive = interval;
|
||||
}
|
||||
|
||||
/// Block until the given callback returns `Stop`, or until an unhandled
|
||||
/// response arrives on the IDLE channel.
|
||||
/// Block until the given callback returns `Stop`, or until a response
|
||||
/// arrives that is not explicitly handled by [`UnsolicitedResponse`].
|
||||
///
|
||||
/// 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
|
||||
|
|
@ -235,8 +235,9 @@ impl<'a, T: SetReadTimeout + Read + Write + 'a> Handle<'a, T> {
|
|||
self.timed_wait(keepalive, true, callback).map(|_| ())
|
||||
}
|
||||
|
||||
/// Block until the given amount of time has elapsed, or the given callback
|
||||
/// returns `Stop`, or until an unhandled response arrives on the IDLE channel.
|
||||
/// Block until the given given amount of time has elapsed, the given callback
|
||||
/// returns `Stop`, or until a response arrives that is not explicitly handled
|
||||
/// by [`UnsolicitedResponse`].
|
||||
pub fn wait_with_timeout<F>(self, timeout: Duration, callback: F) -> Result<WaitOutcome>
|
||||
where
|
||||
F: FnMut(UnsolicitedResponse) -> CallbackAction,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,12 @@ use imap_proto::{
|
|||
|
||||
/// Responses that the server sends that are not related to the current command.
|
||||
/// [RFC 3501](https://tools.ietf.org/html/rfc3501#section-7) states that clients need to be able
|
||||
/// to accept any response at any time. These are the ones we've encountered in the wild.
|
||||
/// to accept any response at any time.
|
||||
///
|
||||
/// Not all possible responses are explicitly enumerated here because in practice only
|
||||
/// some types of responses are delivered as unsolicited responses. If you encounter an
|
||||
/// unsolicited response in the wild that is not handled here, please
|
||||
/// [open an issue](https://github.com/jonhoo/rust-imap/issues) and let us know!
|
||||
///
|
||||
/// Note that `Recent`, `Exists` and `Expunge` responses refer to the currently `SELECT`ed folder,
|
||||
/// so the user must take care when interpreting these.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue