pub struct TrajectoryBuffer { /* private fields */ }Expand description
Lock-free trajectory buffer using crossbeam ArrayQueue
Implementations§
Source§impl TrajectoryBuffer
impl TrajectoryBuffer
Sourcepub fn record(&self, trajectory: QueryTrajectory) -> bool
pub fn record(&self, trajectory: QueryTrajectory) -> bool
Record trajectory (non-blocking)
Returns true if recorded, false if buffer full
Sourcepub fn pop(&self) -> Option<QueryTrajectory>
pub fn pop(&self) -> Option<QueryTrajectory>
Try to pop single trajectory
Sourcepub fn drain(&self) -> Vec<QueryTrajectory>
pub fn drain(&self) -> Vec<QueryTrajectory>
Drain all trajectories
Sourcepub fn drain_n(&self, n: usize) -> Vec<QueryTrajectory>
pub fn drain_n(&self, n: usize) -> Vec<QueryTrajectory>
Drain up to n trajectories
Sourcepub fn dropped_count(&self) -> u64
pub fn dropped_count(&self) -> u64
Get dropped count
Sourcepub fn total_seen(&self) -> u64
pub fn total_seen(&self) -> u64
Get total seen count
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Get success rate
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset statistics (not the buffer contents)
Sourcepub fn get_all(&self) -> Vec<QueryTrajectory>
pub fn get_all(&self) -> Vec<QueryTrajectory>
Get all trajectories (drains buffer - use for export)
Note: This drains the buffer, so trajectories are removed after this call. For export purposes, this is usually what you want since you’ll re-record new trajectories during continued operation.
Auto Trait Implementations§
impl !Freeze for TrajectoryBuffer
impl RefUnwindSafe for TrajectoryBuffer
impl Send for TrajectoryBuffer
impl Sync for TrajectoryBuffer
impl Unpin for TrajectoryBuffer
impl UnwindSafe for TrajectoryBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more