summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2019-04-04 14:21:52 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2019-06-10 19:40:42 +0300
commit1c7aa0ec9c8b3c80f7844a315fc002294b198aa5 (patch)
tree202e28b599e9514acc058fa54e32b92e2e768e23
parentac0e2cbe4480285dbe48f7a819986d21e6079bc2 (diff)
update to 2018 edition
-rw-r--r--Cargo.toml1
-rw-r--r--benches/maildir.rs105
-rw-r--r--benches/parse.rs18
-rw-r--r--melib/Cargo.toml1
-rw-r--r--melib/src/async_workers.rs (renamed from melib/src/async.rs)0
-rw-r--r--melib/src/lib.rs2
-rw-r--r--melib/src/mailbox.rs6
-rw-r--r--melib/src/mailbox/backends.rs17
-rw-r--r--melib/src/mailbox/backends/maildir.rs10
-rw-r--r--melib/src/mailbox/backends/maildir/backend.rs20
-rw-r--r--melib/src/mailbox/collection.rs6
-rw-r--r--melib/src/mailbox/email.rs6
-rw-r--r--melib/src/mailbox/email/attachment_types.rs4
-rw-r--r--melib/src/mailbox/email/attachments.rs8
-rw-r--r--melib/src/mailbox/email/compose.rs6
-rw-r--r--melib/src/mailbox/thread.rs7
-rw-r--r--src/bin.rs8
-rw-r--r--ui/src/conf/accounts.rs8
-rw-r--r--ui/src/workers.rs2
19 files changed, 120 insertions, 115 deletions
diff --git a/Cargo.toml b/Cargo.toml
index dbec664d..e5431e53 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,6 +2,7 @@
name = "meli"
version = "0.1.0"
authors = ["Manos Pitsidianakis <el13635@mail.ntua.gr>"]
+edition = "2018"
[[bin]]
name = "meli"
diff --git a/benches/maildir.rs b/benches/maildir.rs
index c83ecd72..2b970769 100644
--- a/benches/maildir.rs
+++ b/benches/maildir.rs
@@ -1,43 +1,62 @@
-#![feature(test)]
-extern crate melib;
-use melib::conf::Folder;
-use melib::mailbox::backends::maildir::*;
-
-extern crate test;
-use self::test::Bencher;
-
-#[bench]
-fn bench_threads_1(b: &mut Bencher) {
- b.iter(|| {
- let folder = Folder::new(String::from(""), String::from(""), vec![]);
- MaildirType::new("").multicore(1, &folder)
- });
-}
-#[bench]
-fn bench_threads_2(b: &mut Bencher) {
- b.iter(|| {
- let folder = Folder::new(String::from(""), String::from(""), vec![]);
- MaildirType::new("").multicore(2, &folder)
- });
-}
-#[bench]
-fn bench_threads_3(b: &mut Bencher) {
- b.iter(|| {
- let folder = Folder::new(String::from(""), String::from(""), vec![]);
- MaildirType::new("").multicore(3, &folder)
- });
-}
-#[bench]
-fn bench_threads_4(b: &mut Bencher) {
- b.iter(|| {
- let folder = Folder::new(String::from(""), String::from(""), vec![]);
- MaildirType::new("").multicore(4, &folder)
- });
-}
-#[bench]
-fn bench_threads_6(b: &mut Bencher) {
- b.iter(|| {
- let folder = Folder::new(String::from(""), String::from(""), vec![]);
- MaildirType::new("").multicore(6, &folder)
- });
-}
+//#![feature(test)]
+//use melib::conf::AccountSettings;
+//use melib::mailbox::backends::maildir::*;
+//
+//extern crate test;
+//use self::test::Bencher;
+//
+//#[bench]
+//fn bench_threads_1(b: &mut Bencher) {
+// b.iter(|| {
+// let folder = Folder::new(
+// String::from(""),
+// String::from(""),
+// vec![],
+// );
+// MaildirType::new("").multicore(1, &folder)
+// });
+//}
+//#[bench]
+//fn bench_threads_2(b: &mut Bencher) {
+// b.iter(|| {
+// let folder = Folder::new(
+// String::from(""),
+// String::from(""),
+// vec![],
+// );
+// MaildirType::new("").multicore(2, &folder)
+// });
+//}
+//#[bench]
+//fn bench_threads_3(b: &mut Bencher) {
+// b.iter(|| {
+// let folder = Folder::new(
+// String::from(""),
+// String::from(""),
+// vec![],
+// );
+// MaildirType::new("").multicore(3, &folder)
+// });
+//}
+//#[bench]
+//fn bench_threads_4(b: &mut Bencher) {
+// b.iter(|| {
+// let folder = Folder::new(
+// String::from(""),
+// String::from(""),
+// vec![],
+// );
+// MaildirType::new("").multicore(4, &folder)
+// });
+//}
+//#[bench]
+//fn bench_threads_6(b: &mut Bencher) {
+// b.iter(|| {
+// let folder = Folder::new(
+// String::from(""),
+// String::from(""),
+// vec![],
+// );
+// MaildirType::new("").multicore(6, &folder)
+// });
+//}
diff --git a/benches/parse.rs b/benches/parse.rs
index e389841e..d5a07214 100644
--- a/benches/parse.rs
+++ b/benches/parse.rs
@@ -1,12 +1,12 @@
-#![feature(test)]
-extern crate melib;
-
-use melib::mailbox::backends::maildir::MaildirOp;
-use melib::mailbox::backends::BackendOpGenerator;
-use melib::mailbox::email::Envelope;
-
-extern crate test;
-use self::test::Bencher;
+//#![feature(test)]
+//extern crate melib;
+//
+//use melib::mailbox::backends::maildir::MaildirOp;
+//use melib::mailbox::backends::BackendOpGenerator;
+//use melib::mailbox::email::Envelope;
+//
+//extern crate test;
+//use self::test::Bencher;
/*
#[bench]
diff --git a/melib/Cargo.toml b/melib/Cargo.toml
index ba2d27b9..1cc790c3 100644
--- a/melib/Cargo.toml
+++ b/melib/Cargo.toml
@@ -1,6 +1,7 @@
[package]
name = "melib"
version = "0.0.1" #:version
+edition = "2018"
authors = []
workspace = ".."
diff --git a/melib/src/async.rs b/melib/src/async_workers.rs
index 41c2c613..41c2c613 100644
--- a/melib/src/async.rs
+++ b/melib/src/async_workers.rs
diff --git a/melib/src/lib.rs b/melib/src/lib.rs
index 7a983a17..bf249917 100644
--- a/melib/src/lib.rs
+++ b/melib/src/lib.rs
@@ -19,7 +19,7 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
pub mod addressbook;
-pub mod async;
+pub mod async_workers;
pub mod conf;
pub mod error;
pub mod mailbox;
diff --git a/melib/src/mailbox.rs b/melib/src/mailbox.rs
index 4b30ad53..a8054409 100644
--- a/melib/src/mailbox.rs
+++ b/melib/src/mailbox.rs
@@ -29,10 +29,10 @@ pub mod email;
pub use self::email::*;
/* Mail backends. Currently only maildir is supported */
pub mod backends;
-use error::Result;
-use mailbox::backends::Folder;
+use crate::error::Result;
+use self::backends::Folder;
pub mod thread;
-pub use mailbox::thread::{SortField, SortOrder, ThreadNode, Threads};
+pub use self::thread::{SortField, SortOrder, ThreadNode, Threads};
mod collection;
pub use self::collection::*;
diff --git a/melib/src/mailbox/backends.rs b/melib/src/mailbox/backends.rs
index 4ba2d010..0c86552a 100644
--- a/melib/src/mailbox/backends.rs
+++ b/melib/src/mailbox/backends.rs
@@ -22,19 +22,18 @@ pub mod imap;
pub mod maildir;
pub mod mbox;
-use async::*;
-use conf::AccountSettings;
-use error::Result;
+use crate::async_workers::*;
+use crate::conf::AccountSettings;
+use crate::error::Result;
//use mailbox::backends::imap::ImapType;
//use mailbox::backends::mbox::MboxType;
-use mailbox::backends::maildir::MaildirType;
-use mailbox::email::{Envelope, EnvelopeHash, Flag};
+use self::maildir::MaildirType;
+use super::email::{Envelope, EnvelopeHash, Flag};
use std::fmt;
use std::fmt::Debug;
use std::ops::Deref;
-extern crate fnv;
-use self::fnv::FnvHashMap;
+use fnv::FnvHashMap;
use std;
pub type BackendCreator = Box<Fn(&AccountSettings) -> Box<MailBackend>>;
@@ -209,7 +208,7 @@ pub trait BackendOp: ::std::fmt::Debug + ::std::marker::Send {
fn fetch_headers(&mut self) -> Result<&[u8]>;
fn fetch_body(&mut self) -> Result<&[u8]>;
fn fetch_flags(&self) -> Flag;
- fn set_flag(&mut self, &mut Envelope, Flag) -> Result<()>;
+ fn set_flag(&mut self, envelope: &mut Envelope, flag: Flag) -> Result<()>;
}
/// `BackendOpGenerator` is a wrapper for a closure that returns a `BackendOp` object
@@ -238,7 +237,7 @@ impl fmt::Debug for BackendOpGenerator {
pub trait BackendFolder: Debug {
fn hash(&self) -> FolderHash;
fn name(&self) -> &str;
- fn change_name(&mut self, &str);
+ fn change_name(&mut self, new_name: &str);
fn clone(&self) -> Folder;
fn children(&self) -> &Vec<usize>;
}
diff --git a/melib/src/mailbox/backends/maildir.rs b/melib/src/mailbox/backends/maildir.rs
index 65762cd2..94418f21 100644
--- a/melib/src/mailbox/backends/maildir.rs
+++ b/melib/src/mailbox/backends/maildir.rs
@@ -19,15 +19,13 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
-extern crate fnv;
-
mod backend;
pub use self::backend::*;
-use error::{MeliError, Result};
-use mailbox::backends::*;
-use mailbox::email::parser;
-use mailbox::email::{Envelope, Flag};
+use crate::error::{MeliError, Result};
+use crate::mailbox::backends::*;
+use crate::mailbox::email::parser;
+use crate::mailbox::email::{Envelope, Flag};
use memmap::{Mmap, Protection};
use std::collections::hash_map::DefaultHasher;
diff --git a/melib/src/mailbox/backends/maildir/backend.rs b/melib/src/mailbox/backends/maildir/backend.rs
index 86636cf9..1ae6c627 100644
--- a/melib/src/mailbox/backends/maildir/backend.rs
+++ b/melib/src/mailbox/backends/maildir/backend.rs
@@ -19,22 +19,17 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
-extern crate bincode;
-extern crate fnv;
-extern crate notify;
-extern crate xdg;
-
use super::{MaildirFolder, MaildirOp};
-use async::*;
-use conf::AccountSettings;
-use error::{MeliError, Result};
-use mailbox::backends::{
+use crate::async_workers::*;
+use crate::conf::AccountSettings;
+use crate::error::{MeliError, Result};
+use super::{
BackendFolder, BackendOp, Folder, FolderHash, MailBackend, RefreshEvent, RefreshEventConsumer,
RefreshEventKind::*,
};
-use mailbox::email::{Envelope, EnvelopeHash};
+use crate::mailbox::email::{Envelope, EnvelopeHash};
-use self::notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
+use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
use std::time::Duration;
use std::sync::mpsc::channel;
@@ -42,8 +37,7 @@ use std::sync::mpsc::channel;
//use std::sync::mpsc::SyncSender;
//use std::time::Duration;
use std::thread;
-extern crate crossbeam;
-use self::fnv::{FnvHashMap, FnvHasher};
+use fnv::{FnvHashMap, FnvHasher};
use std::collections::hash_map::DefaultHasher;
use std::ffi::OsStr;
use std::fs;
diff --git a/melib/src/mailbox/collection.rs b/melib/src/mailbox/collection.rs
index 9dffab4b..a44d895d 100644
--- a/melib/src/mailbox/collection.rs
+++ b/melib/src/mailbox/collection.rs
@@ -1,14 +1,10 @@
-extern crate bincode;
-extern crate xdg;
-
use super::*;
use std::collections::BTreeMap;
use std::fs;
use std::io;
use std::ops::{Deref, DerefMut};
-extern crate fnv;
-use self::fnv::FnvHashMap;
+use fnv::FnvHashMap;
/// `Mailbox` represents a folder of mail.
#[derive(Debug, Clone, Default)]
diff --git a/melib/src/mailbox/email.rs b/melib/src/mailbox/email.rs
index 6b8b97cd..78f17ea8 100644
--- a/melib/src/mailbox/email.rs
+++ b/melib/src/mailbox/email.rs
@@ -28,12 +28,12 @@ pub use self::compose::*;
mod attachment_types;
pub mod attachments;
-pub use self::attachments::*;
+pub use crate::attachments::*;
pub mod parser;
use parser::BytesExt;
-use error::{MeliError, Result};
-use mailbox::backends::BackendOp;
+use crate::error::{MeliError, Result};
+use super::backends::BackendOp;
use std::borrow::Cow;
use std::cmp::Ordering;
diff --git a/melib/src/mailbox/email/attachment_types.rs b/melib/src/mailbox/email/attachment_types.rs
index da1162c7..ba9b6102 100644
--- a/melib/src/mailbox/email/attachment_types.rs
+++ b/melib/src/mailbox/email/attachment_types.rs
@@ -1,5 +1,5 @@
-use mailbox::email::attachments::Attachment;
-use mailbox::email::parser::BytesExt;
+use crate::mailbox::email::attachments::Attachment;
+use crate::mailbox::email::parser::BytesExt;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::str;
diff --git a/melib/src/mailbox/email/attachments.rs b/melib/src/mailbox/email/attachments.rs
index dadba229..a3929012 100644
--- a/melib/src/mailbox/email/attachments.rs
+++ b/melib/src/mailbox/email/attachments.rs
@@ -19,13 +19,13 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
use data_encoding::BASE64_MIME;
-use mailbox::email::parser;
-use mailbox::email::parser::BytesExt;
-use mailbox::email::EnvelopeWrapper;
+use crate::mailbox::email::parser;
+use crate::mailbox::email::parser::BytesExt;
+use crate::mailbox::email::EnvelopeWrapper;
use std::fmt;
use std::str;
-pub use mailbox::email::attachment_types::*;
+pub use crate::mailbox::email::attachment_types::*;
/*
*
diff --git a/melib/src/mailbox/email/compose.rs b/melib/src/mailbox/email/compose.rs
index 6161b0bb..9841c5c8 100644
--- a/melib/src/mailbox/email/compose.rs
+++ b/melib/src/mailbox/email/compose.rs
@@ -1,7 +1,7 @@
use super::*;
use chrono::{DateTime, Local};
use data_encoding::BASE64_MIME;
-use mailbox::backends::BackendOp;
+use crate::mailbox::backends::BackendOp;
use std::str;
mod mime;
@@ -10,9 +10,7 @@ mod random;
//use self::mime::*;
use super::parser;
-
-extern crate fnv;
-use self::fnv::FnvHashMap;
+use fnv::FnvHashMap;
#[derive(Debug, PartialEq)]
pub struct Draft {
diff --git a/melib/src/mailbox/thread.rs b/melib/src/mailbox/thread.rs
index 78916e93..2a91b53c 100644
--- a/melib/src/mailbox/thread.rs
+++ b/melib/src/mailbox/thread.rs
@@ -32,11 +32,10 @@
* user having mutable ownership.
*/
-use mailbox::email::parser::BytesExt;
-use mailbox::email::*;
+use crate::mailbox::email::parser::BytesExt;
+use crate::mailbox::email::*;
-extern crate fnv;
-use self::fnv::{FnvHashMap, FnvHashSet};
+use fnv::{FnvHashMap, FnvHashSet};
use std::cell::{Ref, RefCell};
use std::cmp;
use std::cmp::Ordering;
diff --git a/src/bin.rs b/src/bin.rs
index 3e268e20..c90a13c9 100644
--- a/src/bin.rs
+++ b/src/bin.rs
@@ -29,19 +29,19 @@ use std::alloc::System;
#[global_allocator]
static GLOBAL: System = System;
-extern crate melib;
-extern crate ui;
+
+use ui;
pub use melib::*;
pub use ui::*;
#[macro_use]
extern crate chan;
-extern crate chan_signal;
+use chan_signal;
use chan_signal::Signal;
-extern crate nix;
+use nix;
fn main() {
/* Lock all stdio outs */
diff --git a/ui/src/conf/accounts.rs b/ui/src/conf/accounts.rs
index d739649c..aefa1cf3 100644
--- a/ui/src/conf/accounts.rs
+++ b/ui/src/conf/accounts.rs
@@ -23,12 +23,12 @@
* Account management from user configuration.
*/
-use async::*;
-use conf::AccountConf;
-use mailbox::backends::{
+use melib::async_workers::{Async, AsyncStatus, AsyncBuilder};
+use super::AccountConf;
+use melib::mailbox::backends::{
Backends, Folder, MailBackend, NotifyFn, RefreshEvent, RefreshEventConsumer, RefreshEventKind,
};
-use mailbox::*;
+use melib::mailbox::*;
use melib::error::Result;
use melib::AddressBook;
diff --git a/ui/src/workers.rs b/ui/src/workers.rs
index ecc8b8d9..3214ff77 100644
--- a/ui/src/workers.rs
+++ b/ui/src/workers.rs
@@ -1,5 +1,5 @@
use chan;
-use melib::async::Work;
+use melib::async_workers::Work;
use std;
use std::mem;
use std::thread;