Skip to content

Commit

Permalink
refacto: remove pub attribute in VarMatches fields
Browse files Browse the repository at this point in the history
  • Loading branch information
vthib committed Oct 8, 2023
1 parent 0432e28 commit c46fa7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 7 additions & 2 deletions boreal/src/evaluator/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ pub(crate) struct VarMatches<'a> {
/// Matches per variable.
///
/// This uses the same order as the variables vec in the scanner object.
pub(crate) matches: &'a [Vec<Match>],
matches: &'a [Vec<Match>],
}

type Match = std::ops::Range<usize>;

impl VarMatches<'_> {
impl<'a> VarMatches<'a> {
/// Create a new `VarMatches` object from a list of variable matches.
pub fn new(matches: &'a [Vec<Match>]) -> Self {
Self { matches }
}

/// Return true if the variable can be found in the scanned memory.
pub fn find(&self, var_index: usize) -> bool {
!self.matches[var_index].is_empty()
Expand Down
4 changes: 1 addition & 3 deletions boreal/src/scanner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,7 @@ impl Inner {
let var_matches = collect_nb_elems(&mut ac_matches_iter, rule.nb_variables);
let res = match evaluate_rule(
rule,
Some(VarMatches {
matches: &var_matches,
}),
Some(VarMatches::new(&var_matches)),
&mut scan_data,
&previous_results,
) {
Expand Down

0 comments on commit c46fa7f

Please sign in to comment.