pub struct AstSize;
Expand description
A simple CostFunction
that counts total ast size.
let e: RecExpr<SymbolLang> = "(do_it foo bar baz)".parse().unwrap();
assert_eq!(AstSize.cost_rec(&e), 4);
Trait Implementations§
source§impl<L: Language> CostFunction<L> for AstSize
impl<L: Language> CostFunction<L> for AstSize
§type Cost = usize
type Cost = usize
The
Cost
type. It only requires PartialOrd
so you can use
floating point types, but failed comparisons (NaN
s) will
result in a panic. Read more