diff --git a/melib/src/mailbox/backends.rs b/melib/src/backends.rs similarity index 100% rename from melib/src/mailbox/backends.rs rename to melib/src/backends.rs diff --git a/melib/src/mailbox/backends/imap.rs b/melib/src/backends/imap.rs similarity index 100% rename from melib/src/mailbox/backends/imap.rs rename to melib/src/backends/imap.rs diff --git a/melib/src/mailbox/backends/maildir.rs b/melib/src/backends/maildir.rs similarity index 98% rename from melib/src/mailbox/backends/maildir.rs rename to melib/src/backends/maildir.rs index e9c0b9af8..72bb3ffb3 100644 --- a/melib/src/mailbox/backends/maildir.rs +++ b/melib/src/backends/maildir.rs @@ -23,10 +23,10 @@ mod backend; pub use self::backend::*; +use crate::backends::*; +use crate::email::parser; +use crate::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/backends/maildir/backend.rs similarity index 99% rename from melib/src/mailbox/backends/maildir/backend.rs rename to melib/src/backends/maildir/backend.rs index c1a99b28f..7815ea5af 100644 --- a/melib/src/mailbox/backends/maildir/backend.rs +++ b/melib/src/backends/maildir/backend.rs @@ -26,8 +26,8 @@ use super::{ use super::{MaildirFolder, MaildirOp}; use crate::async_workers::*; use crate::conf::AccountSettings; +use crate::email::{Envelope, EnvelopeHash}; use crate::error::{MeliError, Result}; -use crate::mailbox::email::{Envelope, EnvelopeHash}; use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher}; use std::time::Duration; diff --git a/melib/src/mailbox/backends/mbox.rs b/melib/src/backends/mbox.rs similarity index 100% rename from melib/src/mailbox/backends/mbox.rs rename to melib/src/backends/mbox.rs diff --git a/melib/src/mailbox/collection.rs b/melib/src/collection.rs similarity index 99% rename from melib/src/mailbox/collection.rs rename to melib/src/collection.rs index 9298d3ea5..375050e6a 100644 --- a/melib/src/mailbox/collection.rs +++ b/melib/src/collection.rs @@ -1,5 +1,5 @@ use super::*; -use crate::mailbox::backends::FolderHash; +use crate::backends::FolderHash; use std::collections::BTreeMap; use std::fs; use std::io; diff --git a/melib/src/mailbox/email.rs b/melib/src/email.rs similarity index 99% rename from melib/src/mailbox/email.rs rename to melib/src/email.rs index 30306e8c5..4078b329b 100644 --- a/melib/src/mailbox/email.rs +++ b/melib/src/email.rs @@ -32,9 +32,9 @@ pub use crate::attachments::*; pub mod parser; use parser::BytesExt; -use super::backends::BackendOp; +use crate::backends::BackendOp; use crate::error::{MeliError, Result}; -use crate::mailbox::thread::ThreadHash; +use crate::thread::ThreadHash; use std::borrow::Cow; use std::cmp::Ordering; diff --git a/melib/src/mailbox/email/attachment_types.rs b/melib/src/email/attachment_types.rs similarity index 98% rename from melib/src/mailbox/email/attachment_types.rs rename to melib/src/email/attachment_types.rs index e6c8d2ff8..6cba27ea9 100644 --- a/melib/src/mailbox/email/attachment_types.rs +++ b/melib/src/email/attachment_types.rs @@ -1,5 +1,5 @@ -use crate::mailbox::email::attachments::Attachment; -use crate::mailbox::email::parser::BytesExt; +use crate::email::attachments::Attachment; +use crate::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/email/attachments.rs similarity index 99% rename from melib/src/mailbox/email/attachments.rs rename to melib/src/email/attachments.rs index 3fa9fd177..bfbedd3ab 100644 --- a/melib/src/mailbox/email/attachments.rs +++ b/melib/src/email/attachments.rs @@ -18,14 +18,14 @@ * You should have received a copy of the GNU General Public License * along with meli. If not, see . */ -use crate::mailbox::email::parser; -use crate::mailbox::email::parser::BytesExt; -use crate::mailbox::email::EnvelopeWrapper; +use crate::email::parser; +use crate::email::parser::BytesExt; +use crate::email::EnvelopeWrapper; use data_encoding::BASE64_MIME; use std::fmt; use std::str; -pub use crate::mailbox::email::attachment_types::*; +pub use crate::email::attachment_types::*; /* * diff --git a/melib/src/mailbox/email/compose.rs b/melib/src/email/compose.rs similarity index 99% rename from melib/src/mailbox/email/compose.rs rename to melib/src/email/compose.rs index 7037a476e..fdfb60994 100644 --- a/melib/src/mailbox/email/compose.rs +++ b/melib/src/email/compose.rs @@ -1,5 +1,5 @@ use super::*; -use crate::mailbox::backends::BackendOp; +use crate::backends::BackendOp; use chrono::{DateTime, Local}; use data_encoding::BASE64_MIME; use std::str; diff --git a/melib/src/mailbox/email/compose/mime.rs b/melib/src/email/compose/mime.rs similarity index 100% rename from melib/src/mailbox/email/compose/mime.rs rename to melib/src/email/compose/mime.rs diff --git a/melib/src/mailbox/email/compose/random.rs b/melib/src/email/compose/random.rs similarity index 100% rename from melib/src/mailbox/email/compose/random.rs rename to melib/src/email/compose/random.rs diff --git a/melib/src/mailbox/email/parser.rs b/melib/src/email/parser.rs similarity index 100% rename from melib/src/mailbox/email/parser.rs rename to melib/src/email/parser.rs diff --git a/melib/src/lib.rs b/melib/src/lib.rs index 4e2d29491..b05dc4ffb 100644 --- a/melib/src/lib.rs +++ b/melib/src/lib.rs @@ -79,10 +79,16 @@ pub mod dbg { pub mod addressbook; pub mod async_workers; +pub mod backends; +mod collection; pub mod conf; +pub mod email; pub mod error; pub mod grapheme_clusters; pub mod mailbox; +pub mod thread; +pub use crate::email::*; +pub use thread::*; mod wcwidth; pub use self::grapheme_clusters::*; pub use self::wcwidth::*; @@ -109,8 +115,8 @@ extern crate uuid; pub use conf::*; pub use mailbox::*; +pub use backends::{Backends, RefreshEvent, RefreshEventConsumer}; +pub use email::{Envelope, Flag}; pub use error::{MeliError, Result}; -pub use mailbox::backends::{Backends, RefreshEvent, RefreshEventConsumer}; -pub use mailbox::email::{Envelope, Flag}; pub use addressbook::*; diff --git a/melib/src/mailbox.rs b/melib/src/mailbox.rs index 773d226df..00e10799f 100644 --- a/melib/src/mailbox.rs +++ b/melib/src/mailbox.rs @@ -25,21 +25,14 @@ * This module handles reading emails from various backends, handling account data etc */ -pub mod email; -pub use self::email::*; -/* Mail backends. Currently only maildir is supported */ -pub mod backends; -use self::backends::Folder; +use crate::backends::Folder; +pub use crate::email::*; use crate::error::Result; -use crate::mailbox::thread::ThreadHash; +use crate::thread::ThreadHash; -pub mod thread; -pub use self::thread::{SortField, SortOrder, ThreadNode, Threads}; +pub use crate::thread::{SortField, SortOrder, ThreadNode, Threads}; -mod collection; -pub use self::collection::*; - -use std::option::Option; +pub use crate::collection::*; use fnv::{FnvHashMap, FnvHashSet}; /// `Mailbox` represents a folder of mail. diff --git a/melib/src/mailbox/thread.rs b/melib/src/thread.rs similarity index 99% rename from melib/src/mailbox/thread.rs rename to melib/src/thread.rs index 287b24b17..7f682f9a5 100644 --- a/melib/src/mailbox/thread.rs +++ b/melib/src/thread.rs @@ -32,9 +32,9 @@ * user having mutable ownership. */ +use crate::email::parser::BytesExt; +use crate::email::*; use crate::grapheme_clusters::*; -use crate::mailbox::email::parser::BytesExt; -use crate::mailbox::email::*; use crate::structs::StackVec; use uuid::Uuid; diff --git a/ui/src/conf/accounts.rs b/ui/src/conf/accounts.rs index 6c7ee294b..83d64ec0b 100644 --- a/ui/src/conf/accounts.rs +++ b/ui/src/conf/accounts.rs @@ -27,12 +27,11 @@ use super::AccountConf; use super::ToggleFlag; use fnv::FnvHashMap; use melib::async_workers::{Async, AsyncBuilder, AsyncStatus}; -use melib::backends::FolderHash; -use melib::error::Result; -use melib::mailbox::backends::{ - BackendOp, Backends, Folder, MailBackend, NotifyFn, RefreshEvent, RefreshEventConsumer, - RefreshEventKind, +use melib::backends::{ + BackendOp, Backends, Folder, FolderHash, MailBackend, NotifyFn, RefreshEvent, + RefreshEventConsumer, RefreshEventKind, }; +use melib::error::Result; use melib::mailbox::*; use melib::thread::ThreadHash; use melib::AddressBook;