This commit is contained in:
Ali Bektas 2023-11-08 16:51:20 +01:00
parent 7e4aad5ba5
commit 25e990d753
2 changed files with 50 additions and 66 deletions

View file

@ -7,7 +7,7 @@ mod dnf;
#[cfg(test)]
mod tests;
use std::fmt;
use std::{collections::HashSet, fmt};
use rustc_hash::FxHashSet;
use tt::SmolStr;
@ -58,6 +58,10 @@ impl CfgOptions {
self.enabled.insert(CfgAtom::KeyValue { key, value });
}
pub fn diff<'a>(&'a self, other: &'a CfgOptions) -> HashSet<&CfgAtom> {
self.enabled.difference(&other.enabled).collect()
}
pub fn apply_diff(&mut self, diff: CfgDiff) {
for atom in diff.enable {
self.enabled.insert(atom);