maniac_runtime/lib.rs
1// #![feature(portable_simd)]
2// #![feature(thread_id_value)]
3#![allow(dead_code)]
4#![allow(unused_variables)]
5#![allow(unused_imports)]
6
7//! # MPMC Queue Wrapper
8//!
9//! High-performance multi-producer multi-consumer queue implementation using
10//! the moodycamel C++ library through BOP's C API.
11//!
12//! This module provides safe Rust wrappers around the high-performance moodycamel
13//! concurrent queue, offering both non-blocking and blocking variants.
14//!
15//! ## Features
16//!
17//! - **Lock-free**: Non-blocking operations for maximum performance
18//! - **Thread-safe**: Multiple producers and consumers can operate concurrently
19//! - **Token-based optimization**: Producer/consumer tokens for better performance
20//! - **Bulk operations**: Efficient batch enqueue/dequeue operations
21//! - **Blocking variant**: Optional blocking operations with timeout support
22//! - **Memory efficient**: Zero-copy operations where possible
23
24pub mod future;
25pub mod generator;
26mod loom_exports;
27pub mod runtime;
28mod spsc;
29pub mod sync;
30pub mod utils;
31
32pub use crate::utils::*;
33
34/// Error occurring when pushing into a queue is unsuccessful.
35#[derive(Debug, Eq, PartialEq)]
36pub enum PushError<T> {
37 /// The queue is full.
38 Full(T),
39 /// The receiver has been dropped.
40 Closed(T),
41}
42
43/// Error occurring when popping from a queue is unsuccessful.
44#[derive(Debug, Eq, PartialEq)]
45pub enum PopError {
46 /// The queue is empty.
47 Empty,
48 /// All senders have been dropped and the queue is empty.
49 Closed,
50 ///
51 Timeout,
52}