Struct egg::AstSize

source ·
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§

The Cost type. It only requires PartialOrd so you can use floating point types, but failed comparisons (NaNs) will result in a panic. Read more
Calculates the cost of an enode whose children are Costs. Read more
Calculates the total cost of a RecExpr. Read more
Formats the value using the given formatter. Read more
Returns the cost of the given e-node. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.