Making the basic example more readable
This commit is contained in:
parent
a87c58bf91
commit
964d7c99ef
1 changed files with 3 additions and 10 deletions
|
|
@ -6,14 +6,9 @@ use imap::client::Client;
|
||||||
use imap::mailbox::Mailbox;
|
use imap::mailbox::Mailbox;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut imap_socket = match Client::secure_connect(("imap.gmail.com", 993), SslContext::new(SslMethod::Sslv23).unwrap()) {
|
let mut imap_socket = Client::secure_connect(("imap.gmail.com", 993), SslContext::new(SslMethod::Sslv23).unwrap()).unwrap();
|
||||||
Ok(s) => s,
|
|
||||||
Err(e) => panic!("{}", e)
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Err(e) = imap_socket.login("username", "password") {
|
imap_socket.login("username", "password").unwrap();
|
||||||
println!("Error: {}", e)
|
|
||||||
};
|
|
||||||
|
|
||||||
match imap_socket.capability() {
|
match imap_socket.capability() {
|
||||||
Ok(capabilities) => {
|
Ok(capabilities) => {
|
||||||
|
|
@ -40,7 +35,5 @@ fn main() {
|
||||||
Err(_) => println!("Error Fetching email 2")
|
Err(_) => println!("Error Fetching email 2")
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) = imap_socket.logout() {
|
imap_socket.logout().unwrap();
|
||||||
println!("Error: {}", e)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue