Expand description
§Photon Ring
Ultra-low-latency SPMC pub/sub using seqlock-stamped ring buffers.
Fully no_std compatible (requires alloc). Every type — including the
named-topic Photon bus — works without the standard library.
§Key design
- Seqlock per slot — stamp and payload share a cache line; readers never take a lock, writers never allocate.
T: Copy— enables safememcpyreads; torn reads are detected and retried (noDrop/ double-free concerns).- Per-consumer cursor — zero contention between subscribers.
- Single-producer — no write-side synchronisation; the seqlock invariant
is upheld by
&mut selfonPublisher::publish.
§Quick start
// Low-level SPMC channel
let (mut pub_, subs) = photon_ring::channel::<u64>(64);
let mut sub = subs.subscribe();
pub_.publish(42);
assert_eq!(sub.try_recv(), Ok(42));
// Named-topic bus
let bus = photon_ring::Photon::<u64>::new(64);
let mut p = bus.publisher("topic-a");
let mut s = bus.subscribe("topic-a");
p.publish(7);
assert_eq!(s.try_recv(), Ok(7));Re-exports§
pub use channel::channel;pub use channel::channel_bounded;pub use channel::channel_mpmc;pub use channel::MpPublisher;pub use channel::PublishError;pub use channel::Publisher;pub use channel::Subscribable;pub use channel::Subscriber;pub use channel::SubscriberGroup;pub use channel::TryRecvError;pub use wait::WaitStrategy;
Modules§
- affinity
- CPU core affinity helpers for deterministic cross-core latency.
- channel
- mem
- Platform-specific memory control for ring buffer allocation.
- wait
- Wait strategies for blocking receive operations.