Skip to main content

diff_cost

Function diff_cost 

Source
pub fn diff_cost(
    diff: &ASTDiff,
    before_metadata: &ASTMetadata,
    after_metadata: &ASTMetadata,
) -> u64
Expand description

Total cost of a finished ASTDiff: sums operation_cost over every entry in diff.mapping: one entry per node (either half of a matched pair, or a lone delete/insert), so this is a straight sum with no double-counting.

before_metadata/after_metadata supply subtree sizes for *WithChildren operations - see operation_cost’s doc comment on why those should never actually appear here today.