lib.rs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //! Tauri is a framework for building tiny, blazing fast binaries for all major desktop platforms.
  2. //! Developers can integrate any front-end framework that compiles to HTML, JS and CSS for building their user interface.
  3. //! The backend of the application is a rust-sourced binary with an API that the front-end can interact with.
  4. //!
  5. //! The user interface in Tauri apps currently leverages Cocoa/WebKit on macOS, gtk-webkit2 on Linux and MSHTML (IE10/11) or Webkit via Edge on Windows.
  6. //! Tauri uses (and contributes to) the MIT licensed project that you can find at [webview](https://github.com/webview/webview).
  7. #![warn(missing_docs, rust_2018_idioms)]
  8. /// The Tauri error enum.
  9. pub use error::Error;
  10. pub use tauri_api as api;
  11. pub(crate) use tauri_api::private::async_runtime;
  12. pub use tauri_macros::*;
  13. /// The Tauri-specific settings for your runtime e.g. notification permission status.
  14. pub mod settings;
  15. /// The Tauri API endpoints.
  16. mod endpoints;
  17. mod error;
  18. mod event;
  19. mod hooks;
  20. /// The plugin manager module contains helpers to manage runtime plugins.
  21. pub mod plugin;
  22. /// The internal runtime between an [`App`] and the webview.
  23. pub mod runtime;
  24. /// Tauri result type.
  25. pub type Result<T> = std::result::Result<T, Error>;
  26. /// A task to run on the main thread.
  27. pub type SyncTask = Box<dyn FnOnce() + Send>;
  28. /// types likely to be used by applications
  29. pub use {
  30. api::config::WindowUrl,
  31. hooks::InvokeMessage,
  32. runtime::app::AppBuilder,
  33. runtime::webview::Attributes,
  34. runtime::{Context, Manager, Params},
  35. };
  36. /// Easy helper function to use the Tauri Context you made during build time.
  37. #[macro_export]
  38. macro_rules! tauri_build_context {
  39. () => {
  40. include!(concat!(env!("OUT_DIR"), "/tauri-build-context.rs"))
  41. };
  42. }
  43. #[cfg(test)]
  44. mod test {
  45. use proptest::prelude::*;
  46. proptest! {
  47. #![proptest_config(ProptestConfig::with_cases(10000))]
  48. #[test]
  49. // check to see if spawn executes a function.
  50. fn check_spawn_task(task in "[a-z]+") {
  51. // create dummy task function
  52. let dummy_task = async move {
  53. format!("{}-run-dummy-task", task);
  54. };
  55. // call spawn
  56. crate::async_runtime::spawn(dummy_task);
  57. }
  58. }
  59. }