Skip to main content

Crate crossbar

Crate crossbar 

Source
Expand description

§crossbar

Zero-copy pub/sub over shared memory. URI-addressed. O(1) transfer at any payload size.

Transfers an 8-byte descriptor through a lock-free ring — O(1) regardless of payload. Subscribers read directly from shared memory via Sample — no copy, no serialization, no service discovery layer.

Supported platforms: Linux, macOS, Windows.

§Quick Start

use crossbar::*;

// Publisher
let mut pub_ = Publisher::create("prices", Config::default()).unwrap();
let topic = pub_.register("/tick/AAPL").unwrap();

let mut loan = pub_.loan(&topic).unwrap();
loan.set_data(b"hello").unwrap();
loan.publish(); // O(1) — writes 8 bytes to ring

Re-exports§

pub use protocol::Config;
pub use protocol::Region;
pub use wait::WaitStrategy;

Modules§

error
Error types for shared-memory pub/sub operations.
protocol
Core protocol types and layout constants for crossbar pub/sub.
wait
Wait strategies for blocking receive operations.

Structs§

BusSubscriber
A subscriber that reads from a PodBus ring via shared memory.
Channel
Bidirectional shared-memory channel.
DiscoveredTopic
A discovered topic from the global registry.
Loan
A mutable view into a pool block in shared memory.
PinnedGuard
Near-zero-overhead read reference to a pinned block in shared memory.
PinnedLoan
Mutable view into a pinned block in shared memory.
PodBus
SPMC broadcast ring for Pod types, backed by shared memory.
Publisher
O(1) zero-copy publisher over shared memory.
Registry
Global topic registry for service discovery.
Sample
Safe zero-copy reference to a published sample in shared memory.
Stream
A subscription to a single topic on a pool-backed pub/sub region.
Subscriber
O(1) zero-copy subscriber for pool-backed pub/sub.
Topic
Handle returned by super::shm::Publisher::register. Identifies a topic for use with super::shm::Publisher::loan.
TypedLoan
Typed mutable loan of a T: Pod value in shared memory.
TypedSample
Typed zero-copy reference to a T: Pod value in shared memory.

Traits§

Pod
Plain-old-data types where every bit pattern is valid.

Functions§

discover
Discover topics matching a URI pattern.