finds.dev← search

// the find

jonhoo/bus

★ 843 · Rust · Apache-2.0 · updated Sep 2023

Efficient, lock-free, bounded Rust broadcast channel

A single-producer, multi-consumer broadcast channel for Rust built on a lock-free circular buffer with atomic operations. Every message goes to every consumer — if you want a fan-out pattern where dropping one consumer doesn't lose messages for others, this is the primitive you reach for. It fills a real gap since std::sync::mpsc is MPSC, not broadcast.

The lock-free circular buffer design means zero mutex contention on the hot path, which matters a lot for high-throughput event fan-out. The API deliberately mirrors std::sync::mpsc, so the mental model transfer cost is low. It's from Jon Gjengset, who has a track record of publishing well-researched Rust concurrency primitives — the implementation is worth reading. Dual MIT/Apache licensing is correct for a library crate.

The README itself warns about busy-waiting in issue #23, and that issue has been open since at least 2020 with no fix — if you're using this under sustained load, you will burn CPU on consumers waiting for messages. Last commit was September 2023, the project feels like it's in maintenance mode at best. There's no async support; if your consumers are async tasks, you're stuck either blocking a thread per consumer or wrapping in a thread bridge. Single producer only — if you need multiple writers, you'll need to wrap it in a Mutex yourself, which undermines the lock-free story.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →