API Reference
crossbeam
A set of concurrent programming tools for Rust, including channels, queues, and scoped threads.
Official Documentation ↗CompatibilityThis documentation covers version
v0.8. Check the official docs for the latest API surface.Installation
cargo
cargo add crossbeamMethods
No methods match this filter.
crossbeam provides MPMC channels, scoped threads, and lock-free data structures.
Key Features
- Multi-producer multi-consumer channels
- Scoped threads borrowing local data
- Lock-free queues and deques
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Errors
The official API reference declares the following error types:
crossbeam::channel::RecvError(Receiver::recv 返回类型 Result<T, RecvError>;空且断开时返回错误) — official text: “pub fn recv(&self) -> Result<T, RecvError> If the channel is empty and becomes disconnected, this call will wake up and return an error.” (source: https://docs.rs/crossbeam/latest/crossbeam/channel/struct.Receiver.html, fetched 2026-11-08T09:38:08.940Z)
API reference evidence
Fetched from official sources on 2026-11-08T09:38:08.940Z via WebFetch https://docs.rs/crossbeam/latest/crossbeam/channel/fn.unbounded.html; WebFetch https://docs.rs/crossbeam/latest/crossbeam/fn.scope.html; WebFetch https://docs.rs/crossbeam/latest/crossbeam/channel/struct.Receiver.html.
crossbeam::scope→ signature from https://docs.rs/crossbeam/latest/crossbeam/fn.scope.html; official text: “pub fn scope<’env, F, R>(f: F) -> Result<R, Box<dyn Any + Send>> where F: FnOnce(&Scope<’env>) -> R Creates a new scope for spawning threads. All child threads that haven’t been manually joined will be automatically join”
FAQ
- How is it different from std channels?
- crossbeam channels are MPMC and support select, while std mpsc is single-consumer.
- What is a scoped thread?
- A thread guaranteed to join before the scope ends, so it can safely borrow stack data without Arc.
- What happens when senders drop?
- The receiver returns an error, which is the standard signal that the channel is closed.
Report a problem with this API docOpens a pre-filled issue on GitHub.