Function dicer::eval [−][src]
pub fn eval(src: &str) -> Result<Vec<EvalResult>, EvalError>
Expand description
Simulates rolling dice for the given string
Example
use dicer::eval;
let expr = String::from("1d20 + 4");
let results = eval(&expr).unwrap();
for res in results {
println!("{} = {}", res.str, res.value);
}