Configuration and Runtime Flags
Config Gate
Bound Work
A numeric limit can gate how much input a program accepts before it stops accumulating work.
Program
Play the program to choose a limit and watch the accepted count change.
limit_gate_config.rs
fn main() {
let limit = ;
let mut accepted = 0;
for value in [3, 8, 13] {
if value <= limit * 5 {
accepted += 1;
}
}
println!("limit={limit} accepted={accepted}");
}
fn main() {
let limit = ;
let mut accepted = 0;
for value in [3, 8, 13] {
if value <= limit * 5 {
accepted += 1;
}
}
println!("limit={limit} accepted={accepted}");
}
fn main() {
let limit = ;
let mut accepted = 0;
for value in [3, 8, 13] {
if value <= limit * 5 {
accepted += 1;
}
}
println!("limit={limit} accepted={accepted}");
}
limit
`limit` is runtime configuration that changes the acceptance threshold.
gate
The `if` condition accepts only values below the configured threshold.
accumulator
`accepted` records how much input passed the gate.