Browse Source

update to 2018 edition

tags/pre-alpha-0.0
Manos Pitsidianakis 10 months ago
parent
commit
1c7aa0ec9c
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS. GPG Key ID: 73627C2F690DF710
19 changed files with 120 additions and 115 deletions
  1. +1
    -0
      Cargo.toml
  2. +62
    -43
      benches/maildir.rs
  3. +9
    -9
      benches/parse.rs
  4. +1
    -0
      melib/Cargo.toml
  5. +0
    -0
      melib/src/async_workers.rs
  6. +1
    -1
      melib/src/lib.rs
  7. +3
    -3
      melib/src/mailbox.rs
  8. +8
    -9
      melib/src/mailbox/backends.rs
  9. +4
    -6
      melib/src/mailbox/backends/maildir.rs
  10. +7
    -13
      melib/src/mailbox/backends/maildir/backend.rs
  11. +1
    -5
      melib/src/mailbox/collection.rs
  12. +3
    -3
      melib/src/mailbox/email.rs
  13. +2
    -2
      melib/src/mailbox/email/attachment_types.rs
  14. +4
    -4
      melib/src/mailbox/email/attachments.rs
  15. +2
    -4
      melib/src/mailbox/email/compose.rs
  16. +3
    -4
      melib/src/mailbox/thread.rs
  17. +4
    -4
      src/bin.rs
  18. +4
    -4
      ui/src/conf/accounts.rs
  19. +1
    -1
      ui/src/workers.rs

+ 1
- 0
Cargo.toml View File

@@ -2,6 +2,7 @@
name = "meli"
version = "0.1.0"
authors = ["Manos Pitsidianakis <el13635@mail.ntua.gr>"]
edition = "2018"

[[bin]]
name = "meli"


+ 62
- 43
benches/maildir.rs View File

@@ -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)
// });
//}

+ 9
- 9
benches/parse.rs View File

@@ -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]


+ 1
- 0
melib/Cargo.toml View File

@@ -1,6 +1,7 @@
[package]
name = "melib"
version = "0.0.1" #:version
edition = "2018"
authors = []
workspace = ".."



melib/src/async.rs → melib/src/async_workers.rs View File


+ 1
- 1
melib/src/lib.rs View File

@@ -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;


+ 3
- 3
melib/src/mailbox.rs View File

@@ -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::*;


+ 8
- 9
melib/src/mailbox/backends.rs View File

@@ -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>;
}


+ 4
- 6
melib/src/mailbox/backends/maildir.rs View File

@@ -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;


+ 7
- 13
melib/src/mailbox/backends/maildir/backend.rs View File

@@ -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;


+ 1
- 5
melib/src/mailbox/collection.rs View File

@@ -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)]


+ 3
- 3
melib/src/mailbox/email.rs View File

@@ -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;


+ 2
- 2
melib/src/mailbox/email/attachment_types.rs View File

@@ -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;



+ 4
- 4
melib/src/mailbox/email/attachments.rs View File

@@ -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::*;

/*
*


+ 2
- 4
melib/src/mailbox/email/compose.rs View File

@@ -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 {


+ 3
- 4
melib/src/mailbox/thread.rs View File

@@ -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;


+ 4
- 4
src/bin.rs View File

@@ -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 */


+ 4
- 4
ui/src/conf/accounts.rs View File

@@ -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;



+ 1
- 1
ui/src/workers.rs View File

@@ -1,5 +1,5 @@
use chan;
use melib::async::Work;
use melib::async_workers::Work;
use std;
use std::mem;
use std::thread;


Loading…
Cancel
Save