get rid of warnings
This commit is contained in:
parent
3cc65d5ce7
commit
aae287c8b1
9 changed files with 73 additions and 42 deletions
|
@ -1,2 +1,14 @@
|
||||||
|
use anyhow::Result;
|
||||||
|
use imap::client::ConfigBuilder;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {}
|
async fn main() -> Result<()> {
|
||||||
|
let _client = ConfigBuilder::default()
|
||||||
|
.hostname(String::from("localhost"))
|
||||||
|
.port(3993)
|
||||||
|
.tls(true)
|
||||||
|
.connect()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
|
@ -28,6 +28,6 @@ impl AuthMethod for Login {
|
||||||
password: &self.password,
|
password: &self.password,
|
||||||
});
|
});
|
||||||
|
|
||||||
let result = inner.execute(command).await;
|
let _result = inner.execute(command).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ where
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn execute<'a>(&mut self, command: Command<'a>) {}
|
pub async fn execute<'a>(&mut self, _command: Command<'a>) {}
|
||||||
|
|
||||||
pub async fn upgrade(self) -> Result<Inner<TlsStream<C>>> {
|
pub async fn upgrade(self) -> Result<Inner<TlsStream<C>>> {
|
||||||
// TODO: check that this capability exists??
|
// TODO: check that this capability exists??
|
||||||
|
|
|
@ -4,16 +4,17 @@ pub mod upgrade;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
||||||
#[derive(Debug, Builder)]
|
#[derive(Clone, Debug, Builder)]
|
||||||
#[builder(build_fn(skip))]
|
#[builder(build_fn(skip))]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
// (required for TLS)
|
// (required for TLS)
|
||||||
hostname: String,
|
hostname: String,
|
||||||
|
port: u16,
|
||||||
tls: bool,
|
tls: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfigBuilder {
|
impl ConfigBuilder {
|
||||||
pub async fn build() -> Result<Client> { todo!() }
|
pub async fn connect(&self) -> Result<Client> { todo!() }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Client;
|
pub struct Client;
|
||||||
|
|
|
@ -80,7 +80,7 @@ pub struct OwnedResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OwnedResponse {
|
impl OwnedResponse {
|
||||||
pub fn request_id(&self) -> Option<&Tag> {
|
pub fn _request_id(&self) -> Option<&Tag> {
|
||||||
match self.response {
|
match self.response {
|
||||||
Response::Done(ResponseDone { ref tag, .. }) => Some(tag),
|
Response::Done(ResponseDone { ref tag, .. }) => Some(tag),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -88,5 +88,5 @@ impl OwnedResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::needless_lifetimes)]
|
#[allow(clippy::needless_lifetimes)]
|
||||||
pub fn parsed<'a>(&'a self) -> &'a Response<'a> { &self.response }
|
pub fn _parsed<'a>(&'a self) -> &'a Response<'a> { &self.response }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#[macro_use]
|
// #[macro_use]
|
||||||
extern crate anyhow;
|
extern crate anyhow;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate async_trait;
|
extern crate async_trait;
|
||||||
#[macro_use]
|
// #[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
|
@ -11,9 +11,7 @@ extern crate derive_builder;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
|
|
||||||
// mod auth;
|
|
||||||
pub mod client;
|
pub mod client;
|
||||||
mod codec;
|
pub mod codec;
|
||||||
mod events;
|
pub mod events;
|
||||||
// mod inner;
|
|
||||||
pub mod proto;
|
pub mod proto;
|
||||||
|
|
|
@ -6,18 +6,18 @@ macro_rules! rule {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! pred {
|
// macro_rules! pred {
|
||||||
($($expr:tt)*) => { |c: u8| _pred!(expr { $($expr)* })(c) };
|
// ($($expr:tt)*) => { |c: u8| _pred!(expr { $($expr)* })(c) };
|
||||||
}
|
// }
|
||||||
|
|
||||||
macro_rules! _pred {
|
// macro_rules! _pred {
|
||||||
(expr {}) => {};
|
// (expr {}) => {};
|
||||||
(expr { $name:ident }) => { |b| $name(b) };
|
// (expr { $name:ident }) => { |b| $name(b) };
|
||||||
(expr { ! $($expr:tt)* }) => { |b| !_pred!(expr { $($expr)* })(b) };
|
// (expr { ! $($expr:tt)* }) => { |b| !_pred!(expr { $($expr)* })(b) };
|
||||||
(expr { ($($L:tt)*) && ($($R:tt)*) }) => {
|
// (expr { ($($L:tt)*) && ($($R:tt)*) }) => {
|
||||||
|b| { _pred!(expr { $($L)* })(b) && _pred!(expr { $($R)* })(b) }
|
// |b| { _pred!(expr { $($L)* })(b) && _pred!(expr { $($R)* })(b) }
|
||||||
};
|
// };
|
||||||
(expr { ($($L:tt)*) || ($($R:tt)*) }) => {
|
// (expr { ($($L:tt)*) || ($($R:tt)*) }) => {
|
||||||
|b| { _pred!(expr { $($L)* })(b) || _pred!(expr { $($R)* })(b) }
|
// |b| { _pred!(expr { $($L)* })(b) || _pred!(expr { $($R)* })(b) }
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
|
@ -7,20 +7,40 @@ use nom::{
|
||||||
|
|
||||||
macro_rules! sep_list {
|
macro_rules! sep_list {
|
||||||
($t:expr) => {
|
($t:expr) => {
|
||||||
map(pair($t, many0(preceded(crate::proto::rfc2234::SP, $t))),
|
map(
|
||||||
|(hd, mut tl)| { tl.insert(0, hd); tl })
|
pair($t, many0(preceded(crate::proto::rfc2234::SP, $t))),
|
||||||
|
|(hd, mut tl)| {
|
||||||
|
tl.insert(0, hd);
|
||||||
|
tl
|
||||||
|
},
|
||||||
|
)
|
||||||
};
|
};
|
||||||
($t:expr, $d:expr) => {
|
($t:expr, $d:expr) => {
|
||||||
map(pair($t, many0(preceded($d, $t))),
|
map(pair($t, many0(preceded($d, $t))), |(hd, mut tl)| {
|
||||||
|(hd, mut tl)| { tl.insert(0, hd); tl })
|
tl.insert(0, hd);
|
||||||
|
tl
|
||||||
|
})
|
||||||
};
|
};
|
||||||
(? $t:expr) => {
|
(? $t:expr) => {
|
||||||
map(opt(pair($t, many0(preceded(crate::proto::rfc2234::SP, $t)))),
|
map(
|
||||||
|opt| opt.map(|(hd, mut tl)| { tl.insert(0, hd); tl }).unwrap_or_else(Vec::new))
|
opt(pair($t, many0(preceded(crate::proto::rfc2234::SP, $t)))),
|
||||||
|
|opt| {
|
||||||
|
opt.map(|(hd, mut tl)| {
|
||||||
|
tl.insert(0, hd);
|
||||||
|
tl
|
||||||
|
})
|
||||||
|
.unwrap_or_else(Vec::new)
|
||||||
|
},
|
||||||
|
)
|
||||||
};
|
};
|
||||||
(? $t:expr, $d:expr) => {
|
(? $t:expr, $d:expr) => {
|
||||||
map(opt(pair($t, many0(preceded($d, $t)))),
|
map(opt(pair($t, many0(preceded($d, $t)))), |opt| {
|
||||||
|opt| opt.map(|(hd, mut tl)| { tl.insert(0, hd); tl }).unwrap_or_else(Vec::new))
|
opt.map(|(hd, mut tl)| {
|
||||||
|
tl.insert(0, hd);
|
||||||
|
tl
|
||||||
|
})
|
||||||
|
.unwrap_or_else(Vec::new)
|
||||||
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +48,7 @@ pub fn never<I, O>(i: I) -> IResult<I, O> { Err(Err::Error(Error::new(i, ErrorKi
|
||||||
|
|
||||||
pub fn skip<E, F, I, O>(mut f: F) -> impl FnMut(I) -> IResult<I, (), E>
|
pub fn skip<E, F, I, O>(mut f: F) -> impl FnMut(I) -> IResult<I, (), E>
|
||||||
where
|
where
|
||||||
I: Clone,
|
I: Clone,
|
||||||
F: Parser<I, O, E>,
|
F: Parser<I, O, E>,
|
||||||
{
|
{
|
||||||
move |i: I| match f.parse(i.clone()) {
|
move |i: I| match f.parse(i.clone()) {
|
||||||
|
|
|
@ -6,16 +6,16 @@ use nom::{
|
||||||
branch::alt,
|
branch::alt,
|
||||||
bytes::streaming::{tag_no_case, take, take_while1},
|
bytes::streaming::{tag_no_case, take, take_while1},
|
||||||
character::streaming::char,
|
character::streaming::char,
|
||||||
combinator::{map, verify, map_res, opt},
|
combinator::{map, map_res, opt, verify},
|
||||||
multi::{many0},
|
multi::many0,
|
||||||
sequence::{delimited, pair, tuple, preceded, separated_pair, terminated},
|
sequence::{delimited, pair, preceded, separated_pair, terminated, tuple},
|
||||||
IResult,
|
IResult,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::parsers::{byte, never, satisfy};
|
use super::parsers::{byte, never, satisfy};
|
||||||
use super::response::{
|
use super::response::{
|
||||||
Atom, Capability, Condition, CowU8, Flag, Mailbox, MailboxData, MailboxList, MailboxListFlag,
|
Atom, Capability, Condition, CowU8, Envelope, Flag, Mailbox, MailboxData, MailboxList,
|
||||||
Response, ResponseCode, Status, Tag, MessageAttribute, Envelope, ResponseText,
|
MailboxListFlag, MessageAttribute, Response, ResponseCode, ResponseText, Status, Tag,
|
||||||
};
|
};
|
||||||
use super::rfc2234::{is_char, is_cr, is_ctl, is_digit, is_dquote, is_lf, is_sp, CRLF, DQUOTE, SP};
|
use super::rfc2234::{is_char, is_cr, is_ctl, is_digit, is_dquote, is_lf, is_sp, CRLF, DQUOTE, SP};
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ rule!(pub QUOTED_CHAR : u8 => alt((satisfy(is_quoted_char), preceded(byte(b'\\')
|
||||||
pub(crate) fn is_quoted_specials(c: u8) -> bool { is_dquote(c) || c == b'\\' }
|
pub(crate) fn is_quoted_specials(c: u8) -> bool { is_dquote(c) || c == b'\\' }
|
||||||
rule!(pub quoted_specials : u8 => satisfy(is_quoted_specials));
|
rule!(pub quoted_specials : u8 => satisfy(is_quoted_specials));
|
||||||
|
|
||||||
// TODO: technically, this is supposed to be
|
// TODO: technically, this is supposed to be
|
||||||
rule!(pub response : Response => alt((continue_req, response_data, response_done)));
|
rule!(pub response : Response => alt((continue_req, response_data, response_done)));
|
||||||
|
|
||||||
rule!(pub response_data : Response => delimited(pair(byte(b'*'), SP), alt((
|
rule!(pub response_data : Response => delimited(pair(byte(b'*'), SP), alt((
|
||||||
|
|
Loading…
Reference in a new issue