Crate tauri

Source
Expand description

Tauri is a framework for building tiny, blazing fast binaries for all major desktop platforms. Developers can integrate any front-end framework that compiles to HTML, JS and CSS for building their user interface. The backend of the application is a rust-sourced binary with an API that the front-end can interact with.

§Cargo features

The following are a list of Cargo features that can be enabled or disabled:

  • wry (enabled by default): Enables the wry runtime. Only disable it if you want a custom runtime.
  • common-controls-v6 (enabled by default): Enables Common Controls v6 support on Windows, mainly for the predefined about menu item.
  • unstable: Enables unstable features. Be careful, it might introduce breaking changes in future minor releases.
  • tracing: Enables tracing for window startup, plugins, Window::eval, events, IPC, updater and custom protocol request handlers.
  • test: Enables the test module exposing unit test helpers.
  • objc-exception: Wrap each msg_send! in a @try/@catch and panics if an exception is caught, preventing Objective-C from unwinding into Rust.
  • linux-libxdo: Enables linking to libxdo which enables Cut, Copy, Paste and SelectAll menu items to work on Linux.
  • isolation: Enables the isolation pattern. Enabled by default if the app > security > pattern > use config option is set to isolation on the tauri.conf.json file.
  • custom-protocol: Feature managed by the Tauri CLI. When enabled, Tauri assumes a production environment instead of a development one.
  • devtools: Enables the developer tools (Web inspector) and window::Window. Enabled by default on debug builds. On macOS it uses private APIs, so you can’t enable it if your app will be published to the App Store.
  • native-tls: Provides TLS support to connect over HTTPS.
  • native-tls-vendored: Compile and statically link to a vendored copy of OpenSSL.
  • rustls-tls: Provides TLS support to connect over HTTPS using rustls.
  • process-relaunch-dangerous-allow-symlink-macos: Allows the process::current_binary function to allow symlinks on macOS (this is dangerous, see the Security section in the documentation website).
  • tray-icon: Enables application tray icon APIs. Enabled by default if the trayIcon config is defined on the tauri.conf.json file.
  • macos-private-api: Enables features only available in macOS’s private APIs, currently the transparent window functionality and the fullScreenEnabled preference setting to true. Enabled by default if the tauri > macosPrivateApi config flag is set to true on the tauri.conf.json file.
  • webview-data-url: Enables usage of data URLs on the webview.
  • compression *(enabled by default): Enables asset compression. You should only disable this if you want faster compile times in release builds - it produces larger binaries.
  • config-json5: Adds support to JSON5 format for tauri.conf.json.
  • config-toml: Adds support to TOML format for the configuration Tauri.toml.
  • image-ico: Adds support to parse .ico image, see [Image].
  • image-png: Adds support to parse .png image, see [Image].
  • macos-proxy: Adds support for WebviewBuilder::proxy_url on macOS. Requires macOS 14+.
  • specta: Add support for specta::specta with Tauri arguments such as State, Window and AppHandle

§Cargo allowlist features

The following are a list of Cargo features that enables commands for Tauri’s API package. These features are automatically enabled by the Tauri CLI based on the allowlist configuration under tauri.conf.json.

§Protocol allowlist

  • protocol-asset: Enables the asset custom protocol.

Re-exports§

Modules§

  • The singleton async runtime used by Tauri and exposed to users.
  • Image types used by this crate and also referenced by the JavaScript API layer.
  • Types and functions related to Inter Procedure Call(IPC).
  • Path APIs.
  • The Tauri plugin extension to expand Tauri functionality.
  • Types and functions related to child processes management.
  • The allowlist scopes.
  • testtest
    Utilities for unit testing on Tauri applications.
  • The Tauri webview types and functions.
  • The Tauri window types and functions.

Macros§

  • Reads the config file at compile time and generates a Context based on its content.
  • Accepts a list of command functions. Creates a handler that allows commands to be called from JS with invoke().
  • Convert a .png or .ico icon to an Image for things like tauri::tray::TrayIconBuilder to consume, relative paths are resolved from CARGO_MANIFEST_DIR, not current file
  • Include a Context that was generated by tauri-build inside your build script.

Structs§

  • The instance of the currently running application.
  • A handle to the currently running application.
  • A resolved asset.
  • The asset resolver is a helper to access the [tauri_utils::assets::Assets] interface.
  • Builds a Tauri application.
  • Api exposed on the CloseRequested event.
  • The Tauri configuration object. It is read from a file where you can define your frontend assets, configure the bundler and define a tray icon.
  • User supplied data required inside of a Tauri application.
  • Information about environment variables.
  • An event that was emitted.
  • A position represented in logical pixels.
  • A size represented in logical pixels.
  • tauri::App package information.
  • A position represented in physical pixels.
  • A size represented in physical pixels.
  • A rectangular region.
  • Map-like data structure storing Tauri’s resources (equivalent to file descriptors).
  • A guard for a state value.
  • The Tauri state manager.
  • Uri scheme protocol context
  • Async uri scheme protocol responder.
  • A parsed URL record.
  • The attributes used to create an webview.
  • Window size constraints

Enums§

Constants§

Traits§

  • Represents a container of file assets that are retrievable during runtime.
  • Emit events.
  • Listen to events.
  • Manages a running application.
  • Resources are Rust objects that are stored in ResourceTable and managed by tauri. They are identified in JS by a numeric ID (the resource ID, or rid). Resources can be created in commands. Resources can also be retrieved in commands by their rid. Resources are thread-safe.
  • The webview runtime interface. A wrapper around runtime::Runtime with the proper user event type associated.
  • The webview runtime handle. A wrapper arond runtime::RuntimeHandle with the proper user event type associated.

Functions§

  • Whether we are running in development mode or not.
  • Get WebView/Webkit version on current platform.

Type Aliases§

  • Unique id of an event.
  • A ResourceId is an integer value referencing a resource. It could be considered to be the tauri equivalent of a file descriptor in POSIX like operating systems.
  • Result<T, ::tauri::Error>
  • A task to run on the main thread.
  • Wrywry
    A Tauri Runtime wrapper around wry.
  • A Tauri RuntimeHandle wrapper around wry.

Attribute Macros§