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;
|
||||
|
||||
fn main() {
|
||||
let mut imap_socket = match Client::secure_connect(("imap.gmail.com", 993), SslContext::new(SslMethod::Sslv23).unwrap()) {
|
||||
Ok(s) => s,
|
||||
Err(e) => panic!("{}", e)
|
||||
};
|
||||
let mut imap_socket = Client::secure_connect(("imap.gmail.com", 993), SslContext::new(SslMethod::Sslv23).unwrap()).unwrap();
|
||||
|
||||
if let Err(e) = imap_socket.login("username", "password") {
|
||||
println!("Error: {}", e)
|
||||
};
|
||||
imap_socket.login("username", "password").unwrap();
|
||||
|
||||
match imap_socket.capability() {
|
||||
Ok(capabilities) => {
|
||||
|
|
@ -40,7 +35,5 @@ fn main() {
|
|||
Err(_) => println!("Error Fetching email 2")
|
||||
};
|
||||
|
||||
if let Err(e) = imap_socket.logout() {
|
||||
println!("Error: {}", e)
|
||||
};
|
||||
imap_socket.logout().unwrap();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue