calc/calc.rs
1use estring::{Aggregate, EString, Product, SepVec, Sum};
2
3type PlusVec<T> = SepVec<T, '+'>;
4type MulVec<T> = SepVec<T, '*'>;
5
6fn main() -> estring::Result<()> {
7 let res = EString::from("10+5*2+3")
8 .parse::<Sum<PlusVec<Product<MulVec<f32>>>>>()?
9 .agg();
10
11 assert_eq!(res, 23.0);
12 Ok(())
13}