Skip to content

Commit 4af4c85

Browse files
feat: update deps
1 parent 02f9b65 commit 4af4c85

File tree

6 files changed

+15
-88
lines changed

6 files changed

+15
-88
lines changed

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ is-it-maintained-open-issues = { repository = "async-email/async-imap" }
2222
default = []
2323

2424
[dependencies]
25-
imap-proto = "0.14.3"
26-
nom = "6.0"
25+
imap-proto = "0.16.1"
26+
nom = "7.0"
2727
base64 = "0.13"
2828
chrono = "0.4"
29-
async-native-tls = { version = "0.3.3" }
29+
async-native-tls = { version = "0.3" }
3030
async-std = { version = "1.8.0", default-features = false, features = ["std"] }
3131
pin-utils = "0.1.0-alpha.4"
3232
futures = "0.3.15"
33-
ouroboros = "0.9"
33+
ouroboros = "0.15"
3434
stop-token = "0.7"
3535
byte-pool = "0.2.2"
3636
once_cell = "1.8.0"
@@ -39,10 +39,10 @@ thiserror = "1.0.9"
3939

4040
[dev-dependencies]
4141
lettre_email = "0.9"
42-
pretty_assertions = "0.6.1"
43-
async-smtp = { version = "0.3.0" }
42+
pretty_assertions = "1.2"
43+
async-smtp = { version = "0.4" }
4444
async-std = { version = "1.8.0", default-features = false, features = ["std", "attributes"] }
45-
tokio = "0.2.6"
45+
tokio = { version = "1", features = ["rt-multi-thread"] }
4646

4747
[[example]]
4848
name = "basic"

examples/tokio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::env;
44
use tokio::runtime::Runtime;
55

66
fn main() -> Result<()> {
7-
let mut rt = Runtime::new().expect("unable to create runtime");
7+
let rt = Runtime::new().expect("unable to create runtime");
88

99
rt.block_on(async {
1010
let args: Vec<String> = env::args().collect();

src/mock_stream.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::pin::Pin;
44
use async_std::io::{Error, ErrorKind, Read, Result, Write};
55
use futures::task::{Context, Poll};
66

7-
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
7+
#[derive(Default, Clone, Debug, Eq, PartialEq, Hash)]
88
pub struct MockStream {
99
read_buf: Vec<u8>,
1010
read_pos: usize,
@@ -14,19 +14,6 @@ pub struct MockStream {
1414
read_delay: usize,
1515
}
1616

17-
impl Default for MockStream {
18-
fn default() -> Self {
19-
MockStream {
20-
read_buf: Vec::new(),
21-
read_pos: 0,
22-
written_buf: Vec::new(),
23-
err_on_read: false,
24-
eof_on_read: false,
25-
read_delay: 0,
26-
}
27-
}
28-
}
29-
3017
impl MockStream {
3118
pub fn new(read_buf: Vec<u8>) -> MockStream {
3219
MockStream::default().with_buf(read_buf)

src/parse.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ mod tests {
446446
assert_eq!(names.len(), 1);
447447
assert_eq!(
448448
names[0].attributes(),
449-
&[NameAttribute::from("\\HasNoChildren")]
449+
&[NameAttribute::Extension("\\HasNoChildren".into())]
450450
);
451451
assert_eq!(names[0].delimiter(), Some("."));
452452
assert_eq!(names[0].name(), "INBOX");
@@ -535,7 +535,7 @@ mod tests {
535535
assert_eq!(names.len(), 1);
536536
assert_eq!(
537537
names[0].attributes(),
538-
&[NameAttribute::from("\\HasNoChildren")]
538+
&[NameAttribute::Extension("\\HasNoChildren".into())]
539539
);
540540
assert_eq!(names[0].delimiter(), Some("."));
541541
assert_eq!(names[0].name(), "INBOX");

src/types/name.rs

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use std::borrow::Cow;
2-
1+
pub use imap_proto::types::NameAttribute;
32
use imap_proto::{MailboxDatum, Response};
43

54
use crate::types::ResponseData;
@@ -21,74 +20,15 @@ pub struct InnerName<'a> {
2120
name: &'a str,
2221
}
2322

24-
/// An attribute set for an IMAP name.
25-
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
26-
pub enum NameAttribute<'a> {
27-
/// It is not possible for any child levels of hierarchy to exist
28-
/// under this name; no child levels exist now and none can be
29-
/// created in the future.
30-
NoInferiors,
31-
32-
/// It is not possible to use this name as a selectable mailbox.
33-
NoSelect,
34-
35-
/// The mailbox has been marked "interesting" by the server; the
36-
/// mailbox probably contains messages that have been added since
37-
/// the last time the mailbox was selected.
38-
Marked,
39-
40-
/// The mailbox does not contain any additional messages since the
41-
/// last time the mailbox was selected.
42-
Unmarked,
43-
44-
/// A non-standard user- or server-defined name attribute.
45-
Custom(Cow<'a, str>),
46-
}
47-
48-
impl NameAttribute<'static> {
49-
fn system(s: &str) -> Option<Self> {
50-
match s {
51-
"\\Noinferiors" => Some(NameAttribute::NoInferiors),
52-
"\\Noselect" => Some(NameAttribute::NoSelect),
53-
"\\Marked" => Some(NameAttribute::Marked),
54-
"\\Unmarked" => Some(NameAttribute::Unmarked),
55-
_ => None,
56-
}
57-
}
58-
}
59-
60-
impl<'a> From<String> for NameAttribute<'a> {
61-
fn from(s: String) -> Self {
62-
if let Some(f) = NameAttribute::system(&s) {
63-
f
64-
} else {
65-
NameAttribute::Custom(Cow::Owned(s))
66-
}
67-
}
68-
}
69-
70-
impl<'a> From<&'a str> for NameAttribute<'a> {
71-
fn from(s: &'a str) -> Self {
72-
if let Some(f) = NameAttribute::system(s) {
73-
f
74-
} else {
75-
NameAttribute::Custom(Cow::Borrowed(s))
76-
}
77-
}
78-
}
79-
8023
impl Name {
8124
pub(crate) fn from_mailbox_data(resp: ResponseData) -> Self {
8225
Name::new(Box::new(resp), |response| match response.parsed() {
8326
Response::MailboxData(MailboxDatum::List {
84-
flags,
27+
name_attributes,
8528
delimiter,
8629
name,
8730
}) => InnerName {
88-
attributes: flags
89-
.iter()
90-
.map(|s| NameAttribute::from(s.as_ref()))
91-
.collect(),
31+
attributes: name_attributes.to_owned(),
9232
delimiter: delimiter.as_deref(),
9333
name,
9434
},

tests/imap_integration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn make_email(to: &str) -> async_smtp::SendableEmail {
110110
vec![to.parse().unwrap()],
111111
)
112112
.unwrap(),
113-
message_id.to_string(),
113+
message_id,
114114
format!("To: <{}>\r\nFrom: <sender@localhost>\r\nMessage-ID: <{}.msg@localhost>\r\nSubject: My first e-mail\r\n\r\nHello world from SMTP", to, message_id),
115115
)
116116
}

0 commit comments

Comments
 (0)