File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -85,8 +85,10 @@ impl SVTracker {
85
85
86
86
// verify tracking completion
87
87
// complete if we're centered on midpoint
88
- let ( first, _) = self . buffer . first_key_value ( ) . unwrap ( ) ; // infaillible at this point
89
- let ( last, _) = self . buffer . last_key_value ( ) . unwrap ( ) ; // infaillible at this point
88
+ let ( first, _) = self . buffer . first_key_value ( ) . unwrap ( ) ;
89
+
90
+ let ( last, _) = self . buffer . last_key_value ( ) . unwrap ( ) ;
91
+
90
92
if !( ( * first < trk_midpoint) && ( * last > trk_midpoint) ) {
91
93
return Err ( FitError :: NotCenteredOnTrackMidpoint ) ;
92
94
}
@@ -265,6 +267,12 @@ impl SVTracker {
265
267
/// Latch a new measurement at given UTC Epoch.
266
268
/// You can then use .fit() to try to fit a track.
267
269
pub fn latch_measurement ( & mut self , utc_t : Epoch , data : FitData ) {
270
+ if let Some ( ( last_t, _) ) = self . buffer . last_key_value ( ) {
271
+ assert ! (
272
+ utc_t > * last_t,
273
+ "samples should be streamed in chronological order"
274
+ ) ;
275
+ }
268
276
self . buffer . insert ( utc_t, data) ;
269
277
}
270
278
You can’t perform that action at this time.
0 commit comments