New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.7.0 examples are out of date #67

Closed
TsarFox opened this Issue Apr 3, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@TsarFox

TsarFox commented Apr 3, 2018

Attempting to compile the example code in README.md with version 0.7.0 of the library yields the following compiler output:

error[E0599]: no method named `capability` found for type `imap::client::Client<native_tls::TlsStream<std::net::TcpStream>>` in the current scope
  --> src/main.rs:19:23
   |
19 |     match imap_socket.capability() {
   |                       ^^^^^^^^^^
   |
   = help: did you mean `capabilities`?

error[E0277]: `imap::Fetch` doesn't implement `std::fmt::Display`
  --> src/main.rs:38:30
   |
38 |                 print!("{}", line);
   |                              ^^^^ `imap::Fetch` cannot be formatted with the default formatter; try using `:?` instead if you are using a format string
   |
   = help: the trait `std::fmt::Display` is not implemented for `imap::Fetch`
   = note: required because of the requirements on the impl of `std::fmt::Display` for `&imap::Fetch`
   = note: required by `std::fmt::Display::fmt`

error: aborting due to 2 previous errors

error: Could not compile `comptest`.

Documentation of this new library interface would be very helpful; I switched to 0.6.0 this morning after a frustrating night of trying to figure out 0.7.0

@jonhoo

This comment has been minimized.

Show comment
Hide comment
@jonhoo

jonhoo Apr 3, 2018

Collaborator

Ouch, yeah, that would be annoying. Good catch!
I'll try to take a look at this today. Ideally we should use cargo-readme so that we can move the example into the documentation in src/lib.rs. That would make it run as a doctest so we could ensure it doesn't break in the future.

For what it's worth, the errors above are fixed by a) using imap_socket.capabilities() (I didn't even know we'd changed the name of that method); and b) using {:?} to use the debug output of Fetch. This latter change is because we used to just return the raw strings that the server gives you when you fetched messages, but we now instead return a Fetch object which holds more structured content (and thus can't directly be printed) :)

Collaborator

jonhoo commented Apr 3, 2018

Ouch, yeah, that would be annoying. Good catch!
I'll try to take a look at this today. Ideally we should use cargo-readme so that we can move the example into the documentation in src/lib.rs. That would make it run as a doctest so we could ensure it doesn't break in the future.

For what it's worth, the errors above are fixed by a) using imap_socket.capabilities() (I didn't even know we'd changed the name of that method); and b) using {:?} to use the debug output of Fetch. This latter change is because we used to just return the raw strings that the server gives you when you fetched messages, but we now instead return a Fetch object which holds more structured content (and thus can't directly be printed) :)

@jonhoo jonhoo closed this in 73c8d0d Apr 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment