Skip to main content

explain_plans

Function explain_plans 

Source
pub fn explain_plans(plans: &[RulePlan]) -> String
Expand description

Render a canonical textual explain of a plan slice.

Plans are sorted by head_predicate (lexicographic), with same-head ties broken by the rendered line body itself under string-lex ordering (so the verdict tag binary-fallback sorts before multiway; the boundary list or variable-order vector breaks remaining ties). Input position is never consulted, so the output is identical for any permutation of the input, including reversal of same-head rules. Locked by explain_plans_is_canonical_under_same_head_reorder.

The displayed per-line index is a per-head rank (0-based, counting only same-head plans encountered earlier in sorted order) so multiple rules under one head remain distinguishable without leaking input position into the canonical form.

One line per rule, format:

{head_predicate}/{per_head_rank}: multiway vars=[X, Y, Z]
{head_predicate}/{per_head_rank}: binary-fallback boundaries=[BodyNegation, ...]