Skip to content

Commit

Permalink
drafted 0.16.0 improved api for nonblocking merging
Browse files Browse the repository at this point in the history
  • Loading branch information
bwsw committed Jul 18, 2022
1 parent 5249bff commit 494b9b5
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions src/track/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,8 @@ where
let dists = track.distances(other, feature_class);
if let Err(e) = &dists {
match e.downcast_ref::<Errors>() {
None => Some(dists),
Some(e) => match e {
Errors::IncompatibleAttributes => None,
_ => Some(dists),
},
Some(Errors::IncompatibleAttributes) => None,
_ => Some(dists),
}
} else {
capacity += dists.as_ref().unwrap().len();
Expand All @@ -238,11 +235,8 @@ where
let dists = track.distances(other, feature_class);
if let Err(e) = &dists {
match e.downcast_ref::<Errors>() {
None => Some(dists),
Some(e) => match e {
Errors::IncompatibleAttributes => None,
_ => Some(dists),
},
Some(Errors::IncompatibleAttributes) => None,
_ => Some(dists),
}
} else {
capacity += dists.as_ref().unwrap().len();
Expand Down Expand Up @@ -280,15 +274,13 @@ where
Some(dest) => {
if dest_id == src.track_id {
Err(Errors::SameTrackCalculation(dest_id).into())
} else if !classes.is_empty() {
dest.merge(&src, &classes, merge_history)
} else {
let res = if !classes.is_empty() {
dest.merge(&src, &classes, merge_history)
} else {
dest.merge(&src, &src.get_feature_classes(), merge_history)
};
res
dest.merge(&src, &src.get_feature_classes(), merge_history)
}
}

None => Err(Errors::TrackNotFound(dest_id).into()),
};

Expand Down

0 comments on commit 494b9b5

Please sign in to comment.