Skip to content

Commit 37b6460

Browse files
committed
builders for score variables
1 parent 62d1c7d commit 37b6460

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/expressions.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ impl Expression {
2020
}
2121
}
2222

23+
/// Creates a new Expression with a reference to the score of the prefetch.
24+
pub fn score() -> Self {
25+
Self {
26+
variant: Some(expression::Variant::Variable("$score".to_string())),
27+
}
28+
}
29+
30+
/// Creates a new Expression with a reference to the score of a specific prefetch, when there are multiple prefetches.
31+
pub fn score_idx(idx: usize) -> Self {
32+
Self {
33+
variant: Some(expression::Variant::Variable(format!("$score[{idx}]"))),
34+
}
35+
}
36+
2337
/// Creates a new Expression with a condition. If true, becomes 1.0; otherwise 0.0.
2438
pub fn condition<C: Into<Condition>>(condition: C) -> Self {
2539
Self {

0 commit comments

Comments
 (0)