@@ -4,7 +4,7 @@ use thiserror::Error;
4
4
use std:: collections:: BTreeMap ;
5
5
use strum_macros:: EnumString ;
6
6
7
- use crate :: { epoch, merge , merge :: Merge , prelude:: SV , prelude:: * , version:: Version } ;
7
+ use crate :: { epoch, prelude:: SV , prelude:: * , version:: Version } ;
8
8
9
9
#[ cfg( feature = "processing" ) ]
10
10
use qc_traits:: { DecimationFilter , DecimationFilterType , FilterItem , MaskFilter , MaskOperand } ;
@@ -310,39 +310,32 @@ pub(crate) fn fmt_epoch(epoch: &Epoch, key: &ClockKey, prof: &ClockProfile) -> S
310
310
lines
311
311
}
312
312
313
+ #[ cfg( feature = "qc" ) ]
313
314
use crate :: merge:: merge_mut_option;
314
315
315
- impl Merge for Record {
316
- /// Merges `rhs` into `Self` without mutable access at the expense of more memcopies
317
- fn merge ( & self , rhs : & Self ) -> Result < Self , merge:: Error > {
318
- let mut lhs = self . clone ( ) ;
319
- lhs. merge_mut ( rhs) ?;
320
- Ok ( lhs)
321
- }
322
- /// Merges `rhs` into `Self`
323
- fn merge_mut ( & mut self , rhs : & Self ) -> Result < ( ) , merge:: Error > {
324
- for ( rhs_epoch, rhs_content) in rhs. iter ( ) {
325
- if let Some ( lhs_content) = self . get_mut ( rhs_epoch) {
326
- for ( rhs_key, rhs_prof) in rhs_content. iter ( ) {
327
- if let Some ( lhs_prof) = lhs_content. get_mut ( rhs_key) {
328
- // enhance only, if possible
329
- merge_mut_option ( & mut lhs_prof. drift , & rhs_prof. drift ) ;
330
- merge_mut_option ( & mut lhs_prof. drift_dev , & rhs_prof. drift_dev ) ;
331
- merge_mut_option ( & mut lhs_prof. drift_change , & rhs_prof. drift_change ) ;
332
- merge_mut_option (
333
- & mut lhs_prof. drift_change_dev ,
334
- & rhs_prof. drift_change_dev ,
335
- ) ;
336
- } else {
337
- lhs_content. insert ( rhs_key. clone ( ) , rhs_prof. clone ( ) ) ;
338
- }
316
+ #[ cfg( feature = "qc" ) ]
317
+ use qc_traits:: MergeError ;
318
+
319
+ #[ cfg( feature = "qc" ) ]
320
+ pub ( crate ) fn merge_mut ( lhs : & mut Record , rhs : & Record ) -> Result < ( ) , MergeError > {
321
+ for ( rhs_epoch, rhs_content) in rhs. iter ( ) {
322
+ if let Some ( lhs_content) = lhs. get_mut ( rhs_epoch) {
323
+ for ( rhs_key, rhs_prof) in rhs_content. iter ( ) {
324
+ if let Some ( lhs_prof) = lhs_content. get_mut ( rhs_key) {
325
+ // enhance only, if possible
326
+ merge_mut_option ( & mut lhs_prof. drift , & rhs_prof. drift ) ;
327
+ merge_mut_option ( & mut lhs_prof. drift_dev , & rhs_prof. drift_dev ) ;
328
+ merge_mut_option ( & mut lhs_prof. drift_change , & rhs_prof. drift_change ) ;
329
+ merge_mut_option ( & mut lhs_prof. drift_change_dev , & rhs_prof. drift_change_dev ) ;
330
+ } else {
331
+ lhs_content. insert ( rhs_key. clone ( ) , rhs_prof. clone ( ) ) ;
339
332
}
340
- } else {
341
- self . insert ( * rhs_epoch, rhs_content. clone ( ) ) ;
342
333
}
334
+ } else {
335
+ lhs. insert ( * rhs_epoch, rhs_content. clone ( ) ) ;
343
336
}
344
- Ok ( ( ) )
345
337
}
338
+ Ok ( ( ) )
346
339
}
347
340
348
341
#[ cfg( feature = "processing" ) ]
0 commit comments