Skip to content

Commit 590b80e

Browse files
jonhoomattnenterprise
authored andcommitted
Add structured results for all values using imap-proto (#58)
* First stab at structured types (#28) Tests currently fail due to djc/imap-proto#2. LSUB is also broken due to djc/imap-proto#4 (but we don't have tests for that atm). * Also parse out RFC822 fetch responses * Make all the things zero-copy * Also delegate IntoIterator for ZeroCopy ref * Fix UNSEEN and LSUB All tests now pass * Address @sanmai-NL comments * Correctly handle incomplete parser responses * No need for git dep anymore
1 parent dc21eae commit 590b80e

File tree

12 files changed

+614
-244
lines changed

12 files changed

+614
-244
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ path = "src/lib.rs"
2828
native-tls = "0.1"
2929
regex = "0.2"
3030
bufstream = "0.1"
31+
imap-proto = "0.3"
32+
nom = "3.2.1"
3133

3234
[dev-dependencies]
3335
base64 = "0.7"

examples/basic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn main() {
1616

1717
imap_socket.login("username", "password").unwrap();
1818

19-
match imap_socket.capability() {
19+
match imap_socket.capabilities() {
2020
Ok(capabilities) => for capability in capabilities.iter() {
2121
println!("{}", capability);
2222
},
@@ -31,8 +31,8 @@ fn main() {
3131
};
3232

3333
match imap_socket.fetch("2", "body[text]") {
34-
Ok(lines) => for line in lines.iter() {
35-
print!("{}", line);
34+
Ok(msgs) => for msg in &msgs {
35+
print!("{:?}", msg);
3636
},
3737
Err(e) => println!("Error Fetching email 2: {}", e),
3838
};

examples/gmail_oauth2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ fn main() {
4444
};
4545

4646
match imap_socket.fetch("2", "body[text]") {
47-
Ok(lines) => for line in lines.iter() {
48-
print!("{}", line);
47+
Ok(msgs) => for msg in &msgs {
48+
print!("{:?}", msg);
4949
},
5050
Err(e) => println!("Error Fetching email 2: {}", e),
5151
};

0 commit comments

Comments
 (0)