Skip to main content

Crate tauri_plugin_conduit

Crate tauri_plugin_conduit 

Source
Expand description

§tauri-plugin-conduit

Tauri v2 plugin for conduit — binary IPC over the conduit:// custom protocol.

Registers a conduit:// custom protocol for zero-overhead in-process binary dispatch. Supports both sync and async handlers via ConduitHandler. No network surface.

§Usage

use tauri_conduit::{command, handler};

#[command]
fn greet(name: String) -> String {
    format!("Hello, {name}!")
}

#[command]
async fn fetch_user(state: State<'_, Db>, id: u64) -> Result<User, String> {
    state.get_user(id).await.map_err(|e| e.to_string())
}

tauri::Builder::default()
    .plugin(
        tauri_plugin_conduit::init()
            .handler("greet", handler!(greet))
            .handler("fetch_user", handler!(fetch_user))
            .channel("telemetry")
            .build()
    )
    .run(tauri::generate_context!())
    .unwrap();

Macros§

handler
Re-export the handler!() macro from conduit-derive.

Structs§

BootstrapInfo
Connection info returned to the frontend during bootstrap.
PluginBuilder
Builder for the conduit Tauri v2 plugin.
PluginState
Shared state for the conduit Tauri plugin.

Functions§

init
Create a new conduit plugin builder.

Attribute Macros§

command
Re-export the #[command] attribute macro from conduit-derive.