lib.rs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //! # libthreema
  2. //!
  3. //! The one stop shop for all your Threema needs!
  4. // We have pretty strict linting rules and it would be a massive hassle having to conditionally
  5. // compile all `pub(crate)` exposed items, depending on the selected features.
  6. //
  7. // The goal is to get it right with features `uniffi`, `wasm` and `cli` enabled (and of course, all
  8. // feature variants still need to compile).
  9. //
  10. // However, it does make sense to disable this from time to time to check for actual issues.
  11. #![cfg_attr(
  12. not(all(feature = "uniffi", feature = "wasm", feature = "cli")),
  13. allow(
  14. dead_code,
  15. unfulfilled_lint_expectations,
  16. unused_crate_dependencies,
  17. unused_imports,
  18. reason = "Don't care for non full-feature builds"
  19. )
  20. )]
  21. #![cfg_attr(
  22. test,
  23. allow(
  24. clippy::arithmetic_side_effects,
  25. clippy::borrow_interior_mutable_const,
  26. clippy::indexing_slicing,
  27. clippy::panic,
  28. clippy::struct_field_names,
  29. clippy::unchecked_time_subtraction,
  30. clippy::unreadable_literal,
  31. clippy::unwrap_used,
  32. unfulfilled_lint_expectations,
  33. unstable_features,
  34. reason = "Be less strict in tests"
  35. )
  36. )]
  37. #![cfg_attr(
  38. test,
  39. allow(clippy::large_stack_arrays, reason = "tests do not need to be efficient")
  40. )]
  41. // Pin generic-array to version 0.14.7 as 0.14.8 was deprecated and RustCrypto needs to upgrade first.
  42. // See https://github.com/fizyk20/generic-array/issues/158
  43. mod external_crate_false_positive_pinned_version {
  44. use generic_array as _;
  45. }
  46. // Avoids dev dependencies used only in examples to be picked up by the linter. Should no longer be
  47. // necessary once https://github.com/rust-lang/cargo/issues/1982 has been resolved.
  48. #[cfg(test)]
  49. mod external_crate_false_positives {
  50. use anyhow as _;
  51. }
  52. #[cfg(feature = "cli")]
  53. mod external_crate_false_positives_cli_feature {
  54. use clap as _;
  55. use futures_util as _;
  56. use rustls as _;
  57. use tokio as _;
  58. use tokio_tungstenite as _;
  59. }
  60. // Set up UniFFI scaffolding for UniFFI bindings
  61. #[cfg(feature = "uniffi")]
  62. uniffi::setup_scaffolding!();
  63. /// Compiled low-level protobuf messages.
  64. #[allow(
  65. clippy::all,
  66. clippy::pedantic,
  67. clippy::restriction,
  68. dead_code,
  69. missing_docs,
  70. rustdoc::broken_intra_doc_links,
  71. rustdoc::unescaped_backticks,
  72. reason = "Code generated by prost"
  73. )]
  74. pub mod protobuf {
  75. /// Common protobuf messages.
  76. pub mod common {
  77. include!(concat!(env!("OUT_DIR"), "/common.rs"));
  78. }
  79. /// End-to-end encrypted messages.
  80. pub mod csp_e2e {
  81. include!(concat!(env!("OUT_DIR"), "/csp_e2e.rs"));
  82. }
  83. /// Device to Device Protocol messages.
  84. pub mod d2d {
  85. include!(concat!(env!("OUT_DIR"), "/d2d.rs"));
  86. }
  87. /// Device to Mediator Protocol messages.
  88. pub mod d2m {
  89. include!(concat!(env!("OUT_DIR"), "/d2m.rs"));
  90. }
  91. /// Data synchronisation messages
  92. pub mod sync {
  93. include!(concat!(env!("OUT_DIR"), "/sync.rs"));
  94. }
  95. pub use sync as d2d_sync;
  96. /// Connection Rendezvous Protocol messages.
  97. pub mod d2d_rendezvous {
  98. include!(concat!(env!("OUT_DIR"), "/rendezvous.rs"));
  99. }
  100. }
  101. pub mod bindings;
  102. #[cfg(feature = "cli")]
  103. pub mod cli;
  104. pub mod common;
  105. pub mod crypto;
  106. pub mod csp;
  107. pub mod csp_e2e;
  108. pub mod d2d_rendezvous;
  109. pub mod d2m;
  110. pub mod https;
  111. pub mod id_backup;
  112. pub mod model;
  113. pub mod remote_secret;
  114. pub mod utils;