This commit is contained in:
Michael Zhang 2021-08-09 00:42:41 -05:00
parent b75df0b8d6
commit 206b9750e0
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
8 changed files with 28 additions and 12 deletions

View file

@ -18,8 +18,10 @@ path = "bin/mzhang_test.rs"
required-features = ["stderrlog"]
[features]
default = ["rfc2177-idle"]
rfc2177-idle = []
default = ["rfc2177", "rfc6154"]
rfc2087 = [] # quota
rfc2177 = [] # idle
rfc6154 = [] # list
[dependencies]
anyhow = "1.0.42"

View file

@ -214,8 +214,8 @@ impl ClientAuthenticated {
}
/// Runs the IDLE command
#[cfg(feature = "rfc2177-idle")]
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177-idle")))]
#[cfg(feature = "rfc2177")]
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177")))]
pub async fn idle(&mut self) -> Result<IdleToken> {
let cmd = Command::Idle;
let stream = self.execute(cmd).await?;
@ -238,15 +238,15 @@ pub struct SelectResponse {
///
/// Dropping this token indicates that the idling should be completed, and the
/// DONE command will be sent to the server as a result.
#[cfg(feature = "rfc2177-idle")]
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177-idle")))]
#[cfg(feature = "rfc2177")]
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177")))]
pub struct IdleToken {
pub stream: ResponseStream,
sender: mpsc::UnboundedSender<String>,
}
#[cfg(feature = "rfc2177-idle")]
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177-idle")))]
#[cfg(feature = "rfc2177")]
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177")))]
impl Drop for IdleToken {
fn drop(&mut self) {
// TODO: should ignore this?
@ -254,8 +254,8 @@ impl Drop for IdleToken {
}
}
#[cfg(feature = "rfc2177-idle")]
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177-idle")))]
#[cfg(feature = "rfc2177")]
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177")))]
impl Stream for IdleToken {
type Item = Response;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {

View file

@ -39,7 +39,7 @@ pub enum Command {
UidSearch(CommandSearch),
// Extensions
#[cfg(feature = "rfc2177-idle")]
#[cfg(feature = "rfc2177")]
Idle,
}

View file

@ -14,6 +14,7 @@ pub mod response;
// parsers
pub mod rfc2234;
pub mod rfc3501;
pub mod rfc6154;
#[cfg(feature = "rfc2177-idle")]
#[cfg(feature = "rfc2177")]
pub mod rfc2177;

View file

@ -1 +1,4 @@
//! IMAP `IDLE` Command
//! ---
//!
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc2177#section-4>

View file

@ -1,3 +1,6 @@
//! ABNF Core Rules
//! ---
//!
//! Grammar from <https://tools.ietf.org/html/rfc2234#section-6.1>
use nom::{branch::alt, multi::many0, sequence::pair};

View file

@ -1,3 +1,6 @@
//! IMAP Specification
//! ---
//!
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc3501#section-9>
use nom::{

View file

@ -0,0 +1,4 @@
//! IMAP `LIST` Extension
//! ---
//!
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc6154#section-6>