src/lib.rs: sync code in doc-comment with examples/basic.rs
is there some way to include the code directly from examples/basic.rs?
This commit is contained in:
parent
abad1f4171
commit
515d574742
2 changed files with 15 additions and 10 deletions
|
|
@ -16,9 +16,9 @@ fn main() {
|
|||
let mut imap_session = match client.login("username", "password") {
|
||||
Ok(c) => c,
|
||||
Err((e, _unauth_client)) => {
|
||||
println!("failed to login: {}", e);
|
||||
eprintln!("failed to login: {}", e);
|
||||
return;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
match imap_session.capabilities() {
|
||||
|
|
|
|||
21
src/lib.rs
21
src/lib.rs
|
|
@ -6,9 +6,8 @@
|
|||
//! See the `examples/` directory for more examples.
|
||||
//!
|
||||
//! ```no_run
|
||||
//! # extern crate imap;
|
||||
//! extern crate imap;
|
||||
//! extern crate native_tls;
|
||||
//! # use imap::client::Client;
|
||||
//!
|
||||
//! // To connect to the gmail IMAP server with this you will need to allow unsecure apps access.
|
||||
//! // See: https://support.google.com/accounts/answer/6010255?hl=en
|
||||
|
|
@ -18,11 +17,17 @@
|
|||
//! let port = 993;
|
||||
//! let socket_addr = (domain, port);
|
||||
//! let ssl_connector = native_tls::TlsConnector::builder().build().unwrap();
|
||||
//! let mut imap_socket = Client::secure_connect(socket_addr, domain, &ssl_connector).unwrap();
|
||||
//! let client = imap::client::secure_connect(socket_addr, domain, &ssl_connector).unwrap();
|
||||
//!
|
||||
//! imap_socket.login("username", "password").unwrap();
|
||||
//! let mut imap_session = match client.login("username", "password") {
|
||||
//! Ok(c) => c,
|
||||
//! Err((e, _unauth_client)) => {
|
||||
//! eprintln!("failed to login: {}", e);
|
||||
//! return;
|
||||
//! }
|
||||
//! };
|
||||
//!
|
||||
//! match imap_socket.capabilities() {
|
||||
//! match imap_session.capabilities() {
|
||||
//! Ok(capabilities) => {
|
||||
//! for capability in capabilities.iter() {
|
||||
//! println!("{}", capability);
|
||||
|
|
@ -31,14 +36,14 @@
|
|||
//! Err(e) => println!("Error parsing capabilities: {}", e),
|
||||
//! };
|
||||
//!
|
||||
//! match imap_socket.select("INBOX") {
|
||||
//! match imap_session.select("INBOX") {
|
||||
//! Ok(mailbox) => {
|
||||
//! println!("{}", mailbox);
|
||||
//! }
|
||||
//! Err(e) => println!("Error selecting INBOX: {}", e),
|
||||
//! };
|
||||
//!
|
||||
//! match imap_socket.fetch("2", "body[text]") {
|
||||
//! match imap_session.fetch("2", "body[text]") {
|
||||
//! Ok(messages) => {
|
||||
//! for message in messages.iter() {
|
||||
//! print!("{:?}", message);
|
||||
|
|
@ -47,7 +52,7 @@
|
|||
//! Err(e) => println!("Error Fetching email 2: {}", e),
|
||||
//! };
|
||||
//!
|
||||
//! imap_socket.logout().unwrap();
|
||||
//! imap_session.logout().unwrap();
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue