Skip to content

Commit

Permalink
Add specs() accessor to the PlatformEval type. (#423)
Browse files Browse the repository at this point in the history
This helps `guppy` clients which don't want to `eval` the condition, and
instead want to decompose and analyze the condition. An example of one
such client can be found in:

* https://crrev.com/c/6259145/9/tools/crates/gnrt/lib/deps.rs#406
* https://crrev.com/c/6259145/9/tools/crates/gnrt/lib/gn.rs#513
  • Loading branch information
anforowicz authored Feb 21, 2025
1 parent 0dbe4df commit a0ad2c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion guppy/src/platform/platform_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub struct PlatformEval<'g> {

assert_covariant!(PlatformEval);

impl PlatformEval<'_> {
impl<'g> PlatformEval<'g> {
/// Runs this evaluator against the given platform.
pub fn eval(&self, platform: &Platform) -> EnabledTernary {
let mut res = EnabledTernary::Disabled;
Expand All @@ -173,6 +173,11 @@ impl PlatformEval<'_> {
}
res
}

/// Returns the target specs.
pub fn specs<'a>(&'a self) -> impl Iterator<Item = &'g TargetSpec> + 'a {
self.specs.iter()
}
}

#[derive(Clone, Debug)]
Expand Down

0 comments on commit a0ad2c4

Please sign in to comment.