conduit-derive 2.1.1

Proc macros for conduit-core: Encode, Decode, #[command], handler!().
Documentation

conduit-derive

Crates.io docs.rs CI License

Proc macros for conduit-core: #[derive(Encode, Decode)], #[command], and handler!().

Part of the tauri-conduit workspace (v2.1.1).

Usage

Binary codec

use conduit_derive::{Encode, Decode};

#[derive(Encode, Decode)]
struct MarketTick {
    timestamp: i64,
    price: f64,
    volume: f64,
    side: u8,
}
// 25 bytes on the wire. No schema, no parsing.

Supported field types: u8-u64, i8-i64, f32, f64, bool, Vec<u8>, String, Bytes.

The Decode derive automatically generates a MIN_SIZE constant for upfront bounds checking.

Command handlers

use conduit::{command, handler};

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

// Register with handler!() macro:
// .handler("greet", handler!(greet))

#[command] supports named parameters, State<T> injection, AppHandle, Window/Webview injection, Result<T, E> returns, and async functions.

See the workspace README for full documentation.

License

Licensed under either of MIT or Apache-2.0 at your option.