You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.3KB

  1. /*
  2. * meli - lib.rs
  3. *
  4. * Copyright 2017 Manos Pitsidianakis
  5. *
  6. * This file is part of meli.
  7. *
  8. * meli is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * meli is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with meli. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #[macro_use]
  22. pub mod dbg {
  23. #[allow(clippy::redundant_closure)]
  24. #[macro_export]
  25. macro_rules! debug {
  26. ($val:literal) => {
  27. {
  28. if cfg!(debug_assertions) {
  29. eprint!(
  30. "[{:?}] {}:{}_{}: ",
  31. std::thread::current()
  32. .name()
  33. .map(std::string::ToString::to_string)
  34. .unwrap_or_else(|| format!("{:?}", std::thread::current().id())),
  35. file!(),
  36. line!(),
  37. column!()
  38. );
  39. eprintln!($val);
  40. }
  41. $val
  42. }
  43. };
  44. ($val:expr) => {
  45. {
  46. if cfg!(debug_assertions) {
  47. eprint!(
  48. "[{:?}] {}:{}_{}: ",
  49. std::thread::current()
  50. .name()
  51. .map(std::string::ToString::to_string)
  52. .unwrap_or_else(|| format!("{:?}", std::thread::current().id())),
  53. file!(),
  54. line!(),
  55. column!()
  56. );
  57. eprintln!("{} = {:?}", stringify!($val), $val);
  58. }
  59. $val
  60. }
  61. };
  62. ($fmt:literal, $($arg:tt)*) => {
  63. if cfg!(debug_assertions) {
  64. eprint!(
  65. "[{:?}] {}:{}_{}: ",
  66. std::thread::current()
  67. .name()
  68. .map(std::string::ToString::to_string)
  69. .unwrap_or_else(|| format!("{:?}", std::thread::current().id())),
  70. file!(),
  71. line!(),
  72. column!()
  73. );
  74. eprintln!($fmt, $($arg)*);
  75. }
  76. };
  77. }
  78. }
  79. pub mod addressbook;
  80. pub mod async_workers;
  81. pub mod backends;
  82. mod collection;
  83. pub mod conf;
  84. pub mod email;
  85. pub mod error;
  86. pub mod grapheme_clusters;
  87. pub mod mailbox;
  88. pub mod thread;
  89. pub use crate::email::*;
  90. pub use crate::thread::*;
  91. mod wcwidth;
  92. pub use self::grapheme_clusters::*;
  93. pub use self::wcwidth::*;
  94. mod structs;
  95. pub use self::structs::*;
  96. #[macro_use]
  97. extern crate serde_derive;
  98. /* parser */
  99. #[macro_use]
  100. extern crate nom;
  101. extern crate chrono;
  102. extern crate data_encoding;
  103. extern crate encoding;
  104. extern crate memmap;
  105. #[macro_use]
  106. extern crate chan;
  107. #[macro_use]
  108. extern crate bitflags;
  109. extern crate fnv;
  110. extern crate uuid;
  111. pub use crate::conf::*;
  112. pub use crate::mailbox::*;
  113. pub use crate::backends::{Backends, RefreshEvent, RefreshEventConsumer};
  114. pub use crate::email::{Envelope, Flag};
  115. pub use crate::error::{MeliError, Result};
  116. pub use crate::addressbook::*;