Crate indexbus_kit

Crate indexbus_kit 

Source
Expand description

indexbus-kit is the final, application-facing ergonomics layer for IndexBus.

It exists to make it easy to assemble correct applications from the substrate crates (indexbus-abi, indexbus-core, transports, routing, codecs) without hiding what is actually happening.

§Design constraints

  • Keep substrate crates explicit and stable (indexbus-abi, indexbus-core, transports).
  • Put ergonomics here: thin wrappers, safe constructors, curated re-exports.
  • Prefer feature-gated optional integrations (blocking, runtimes, UDP, etc.).

§Kit contract (stability vs convenience)

indexbus-kit is intentionally a kit, not a substrate layer. That means it provides convenience APIs for apps while remaining conservative about what it promises to keep stable.

Stable-by-intent (contract surface):

  • Feature flags behave as documented in the crate’s Cargo.toml (e.g. no_std requires alloc, std enables host-side helpers).
  • Error behavior: helpers return crate::errors::Result and do not silently swallow substrate errors.
  • embedded, msg, and typed modules aim to remain source-compatible and are the preferred surface for “library-like” reuse inside an application.

Convenience (may change as patterns evolve):

  • crate::prelude contents and re-exports.
  • lanes::* orchestration helpers (thread spawning, region open helpers, defaults).
  • shm temp-path helpers and small wiring shims.

This crate is intended to be the clear onboarding story for IndexBus: if you’re building an application (not a new transport or ABI/layout), start here.

Module map (discoverability-first):

  • lanes: named lanes (routing, sequencer, journal) for host-side flows.
  • embedded: static-memory/no-heap building blocks intended to be no_std friendly.
  • typed: typed message helpers (codec selection + constructors).
  • msg: envelope/header helpers.
  • runtime/blocking/transport/shm: host integrations (std-only).

§Minimal embedded-style SPSC

use indexbus_kit::embedded::static_spsc;
use indexbus_kit::errors::Result;

// `static_spsc()` is single-use (it returns handles into a single static region).
let (tx, rx) = static_spsc().unwrap();
tx.publish(b"hi").unwrap();

let mut out = [0u8; 64];
let n = rx.try_recv_into(&mut out).unwrap().unwrap();
assert_eq!(&out[..n], b"hi");

Modules§

embedded
Embedded-oriented helpers (static memory, no-heap algorithms).
errors
Error type and Result alias used throughout indexbus-kit. Error type used by indexbus-kit.
lanes
Named lane modules.
msg
indexbus-msg envelope helpers.
prelude
Curated prelude for application code.
runtime
Runtime-facing helpers.
shm
SHM helpers: temp paths, region open options, cleanup.
transport
Transport helpers and re-exports.
typed
Typed-message helpers.