meli/melib/src/lib.rs

123 lines
3.3 KiB
Rust
Raw Normal View History

/*
* meli - lib.rs
*
* Copyright 2017 Manos Pitsidianakis
*
* This file is part of meli.
*
* meli is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* meli is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
2019-05-01 19:20:33 +03:00
#[macro_use]
pub mod dbg {
2019-05-13 22:05:00 +03:00
#[allow(clippy::redundant_closure)]
2019-05-01 19:20:33 +03:00
#[macro_export]
macro_rules! debug {
2019-05-07 01:54:20 +03:00
($val:literal) => {
2019-05-12 17:37:07 +03:00
{
2019-05-07 01:54:20 +03:00
if cfg!(debug_assertions) {
eprint!(
"[{:?}] {}:{}_{}: ",
std::thread::current()
.name()
2019-06-18 21:13:58 +03:00
.map(std::string::ToString::to_string)
2019-05-07 01:54:20 +03:00
.unwrap_or_else(|| format!("{:?}", std::thread::current().id())),
file!(),
line!(),
column!()
);
eprintln!($val);
}
2019-05-12 17:37:07 +03:00
$val
}
2019-05-07 01:54:20 +03:00
};
2019-05-01 19:20:33 +03:00
($val:expr) => {
2019-05-12 17:37:07 +03:00
{
2019-05-01 19:20:33 +03:00
if cfg!(debug_assertions) {
eprint!(
"[{:?}] {}:{}_{}: ",
std::thread::current()
.name()
2019-06-18 21:13:58 +03:00
.map(std::string::ToString::to_string)
2019-05-01 19:20:33 +03:00
.unwrap_or_else(|| format!("{:?}", std::thread::current().id())),
file!(),
line!(),
column!()
);
2019-05-03 23:50:58 +03:00
eprintln!("{} = {:?}", stringify!($val), $val);
2019-05-01 19:20:33 +03:00
}
2019-05-12 17:37:07 +03:00
$val
}
2019-05-01 19:20:33 +03:00
};
($fmt:literal, $($arg:tt)*) => {
if cfg!(debug_assertions) {
eprint!(
"[{:?}] {}:{}_{}: ",
std::thread::current()
.name()
2019-06-18 21:13:58 +03:00
.map(std::string::ToString::to_string)
2019-05-01 19:20:33 +03:00
.unwrap_or_else(|| format!("{:?}", std::thread::current().id())),
file!(),
line!(),
column!()
);
eprintln!($fmt, $($arg)*);
}
};
}
}
2019-03-14 12:19:25 +02:00
pub mod addressbook;
2019-04-04 14:21:52 +03:00
pub mod async_workers;
2019-05-26 15:54:45 +03:00
pub mod backends;
mod collection;
pub mod conf;
2019-05-26 15:54:45 +03:00
pub mod email;
pub mod error;
2019-05-26 02:10:57 +03:00
pub mod grapheme_clusters;
2018-07-27 21:37:56 +03:00
pub mod mailbox;
2019-05-26 15:54:45 +03:00
pub mod thread;
pub use crate::email::*;
2019-06-18 21:13:58 +03:00
pub use crate::thread::*;
2019-05-26 02:10:57 +03:00
mod wcwidth;
pub use self::grapheme_clusters::*;
pub use self::wcwidth::*;
2019-05-26 21:34:34 +03:00
mod structs;
pub use self::structs::*;
#[macro_use]
extern crate serde_derive;
/* parser */
#[macro_use]
extern crate nom;
extern crate chrono;
2018-07-24 20:20:32 +03:00
extern crate data_encoding;
2018-07-27 21:37:56 +03:00
extern crate encoding;
extern crate memmap;
2018-08-03 13:46:08 +03:00
#[macro_use]
extern crate chan;
#[macro_use]
extern crate bitflags;
2019-02-15 09:06:42 +02:00
extern crate fnv;
2019-03-14 12:19:25 +02:00
extern crate uuid;
2017-09-28 18:06:35 +03:00
2019-06-18 21:13:58 +03:00
pub use crate::conf::*;
pub use crate::mailbox::*;
2017-09-28 18:06:35 +03:00
2019-06-18 21:13:58 +03:00
pub use crate::backends::{Backends, RefreshEvent, RefreshEventConsumer};
pub use crate::email::{Envelope, Flag};
pub use crate::error::{MeliError, Result};
2019-02-15 09:06:42 +02:00
2019-06-18 21:13:58 +03:00
pub use crate::addressbook::*;