MCPcopy Create free account
hub / github.com/ZettaScaleLabs/hiroz / BoundedQueue

Class BoundedQueue

crates/hiroz/src/queue.rs:16–24  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
16pub 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
26impl<T> BoundedQueue<T> {
27 /// Create a new bounded queue with the specified capacity.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected