conduit-core
Binary IPC core for Tauri v2: codec, router, ring buffer, and ordered queue.
Part of the tauri-conduit workspace (v2.0.0).
Features
- 11-byte frame codec with
Encode/Decodetraits for zero-parse binary serialization - Synchronous router for named command handlers (raw, JSON, and binary)
- In-process ring buffer (
RingBuffer) with lossy back-pressure for streaming - Ordered queue (
Queue) with guaranteed delivery and backpressure - Channel abstraction (
ChannelBuffer) unifying lossy and ordered channels
Key Types
| Type | Purpose |
|---|---|
Router |
Named synchronous command registry (register, register_json, register_binary, call) |
RingBuffer |
Thread-safe lossy circular buffer — oldest frames dropped on overflow |
Queue |
Thread-safe ordered buffer — backpressure when full, no data loss |
ChannelBuffer |
Enum wrapping RingBuffer (Lossy) or Queue (Reliable) with a unified push/drain API |
ConduitHandler |
Trait for sync/async command handlers, implemented by #[command]-generated structs |
HandlerResponse |
Enum: Sync(Result<Vec<u8>, Error>) or Async(Pin<Box<dyn Future>>) |
HandlerContext |
Context passed to handlers: app handle + optional webview label |
PushOutcome |
Enum: Accepted(usize) or TooLarge — opt-in via push_checked() |
FrameHeader |
11-byte binary frame header for all conduit messages |
Encode / Decode |
Traits for fixed-layout binary serialization |
Error |
Error types (UnknownCommand, DecodeFailed, Serialize, UnknownChannel, etc.) |
Usage
use ;
// Raw handler
let router = new;
router.register;
let response = router.call.unwrap;
assert_eq!;
// JSON handler
router.register_json;
// Binary handler (with Encode/Decode types)
// router.register_binary("process", |tick: MarketTick| tick);
Benchmarks
Includes a head-to-head comparison benchmark against JSON (serde):
See the workspace README for full documentation and benchmark numbers.
License
Licensed under either of MIT or Apache-2.0 at your option.