Skip to content

Commit

Permalink
Add structured results for all values using imap-proto (#58)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jonhoo authored and mattnenterprise committed Feb 9, 2018
1 parent dc21eae commit 590b80e
Show file tree
Hide file tree
Showing 12 changed files with 614 additions and 244 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ path = "src/lib.rs"
native-tls = "0.1"
regex = "0.2"
bufstream = "0.1"
imap-proto = "0.3"
nom = "3.2.1"

[dev-dependencies]
base64 = "0.7"
6 changes: 3 additions & 3 deletions examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {

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

match imap_socket.capability() {
match imap_socket.capabilities() {
Ok(capabilities) => for capability in capabilities.iter() {
println!("{}", capability);
},
Expand All @@ -31,8 +31,8 @@ fn main() {
};

match imap_socket.fetch("2", "body[text]") {
Ok(lines) => for line in lines.iter() {
print!("{}", line);
Ok(msgs) => for msg in &msgs {
print!("{:?}", msg);
},
Err(e) => println!("Error Fetching email 2: {}", e),
};
Expand Down
4 changes: 2 additions & 2 deletions examples/gmail_oauth2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ fn main() {
};

match imap_socket.fetch("2", "body[text]") {
Ok(lines) => for line in lines.iter() {
print!("{}", line);
Ok(msgs) => for msg in &msgs {
print!("{:?}", msg);
},
Err(e) => println!("Error Fetching email 2: {}", e),
};
Expand Down
Loading

0 comments on commit 590b80e

Please sign in to comment.