1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Queue management module (FR-011, FR-017)
//!
//! This module provides bounded queue functionality with configurable
//! overflow policies for CAN message handling.
//!
//! # Overview
//!
//! The queue module provides a bounded message queue that prevents unbounded
//! memory growth when messages arrive faster than they can be processed.
//!
//! # Components
//!
//! - [`BoundedQueue`]: A fixed-capacity queue for CAN messages
//! - [`QueueOverflowPolicy`]: Strategy for handling queue overflow
//! - [`QueueStats`]: Statistics about queue operations
//! - [`QueueConfig`]: Configuration loaded from TOML files
//!
//! # Overflow Policies
//!
//! When the queue is full, one of these policies is applied:
//!
//! - [`QueueOverflowPolicy::DropOldest`]: Remove the oldest message (default)
//! - [`QueueOverflowPolicy::DropNewest`]: Reject the new message
//! - [`QueueOverflowPolicy::Block`]: Block until space is available (with timeout)
//!
//! # Example
//!
//! ```rust
//! use canlink_hal::queue::{BoundedQueue, QueueOverflowPolicy};
//! use canlink_hal::CanMessage;
//!
//! // Create a queue with capacity 100 and DropOldest policy
//! let mut queue = BoundedQueue::with_policy(100, QueueOverflowPolicy::DropOldest);
//!
//! // Push messages
//! let msg = CanMessage::new_standard(0x123, &[1, 2, 3]).unwrap();
//! queue.push(msg).unwrap();
//!
//! // Pop messages
//! if let Some(msg) = queue.pop() {
//! println!("Received: {:?}", msg);
//! }
//!
//! // Check statistics
//! let stats = queue.stats();
//! println!("Enqueued: {}, Dequeued: {}, Dropped: {}",
//! stats.enqueued, stats.dequeued, stats.dropped);
//! ```
//!
//! # Thread Safety
//!
//! `BoundedQueue` is not thread-safe by itself. For multi-threaded access,
//! wrap it in appropriate synchronization primitives (e.g., `Mutex`, `RwLock`).
pub use ;
pub use QueueConfig;
pub use QueueOverflowPolicy;