A bounded queue that drops the OLDEST element when full (ROS depth QoS behavior). Unlike channels that block or drop the newest element when full, this queue maintains the most recent N elements, where N is the capacity.
| 14 | /// Unlike channels that block or drop the newest element when full, this queue |
| 15 | /// maintains the most recent N elements, where N is the capacity. |
| 16 | pub struct BoundedQueue<T> { |
| 17 | data: Mutex<VecDeque<T>>, |
| 18 | /// Condvar for blocking recv operations |
| 19 | not_empty: Condvar, |
| 20 | /// Runtime-agnostic async notification |
| 21 | event: Event, |
| 22 | /// Maximum capacity (usize::MAX = unlimited for KeepAll) |
| 23 | capacity: usize, |
| 24 | } |
| 25 | |
| 26 | impl<T> BoundedQueue<T> { |
| 27 | /// Create a new bounded queue with the specified capacity. |
nothing calls this directly
no outgoing calls
no test coverage detected