chore: Demonstrate use of hashmap with new result objects for analysis storage #130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses the 4th task in #28 , showing how the new
results.rs
structs/enums can be used to replaceAnalysisResults
with aHashmap<String, HCStoredResult>
, enabling a future dynamic set of analyses to support the plugin architecture.Particular focus on impl of
struct AltAnalysisResults
and the code savings of the following line:let (act_score, outcome) = alt_results.table.get(ACTIVITY_PHASE).unwrap().score();
I also updated
AnalysisResults::activity
to be of typeOption<HCStoredResults>
. Since this makes it so the compiler cannot know the type is reallyThresholdPredicate
insidedyn HCPredicate
, I had to do someAny
wizardry and addas_any()
as a trait func forHCPredicate
soreport_builder.rs
could downcast it as such:let Some(pred) = analysis.as_any().downcast_ref::<ThresholdPredicate>()
. This may be able to be removed in the future if new reporting infrastructure removes then need to access particular predicate fields.