Reporter is an [Option] that can be passed to [Equal]. When [Equal] traverses the value trees, it calls PushStep as it descends into each node in the tree and PopStep as it ascend out of the node. The leaves of the tree are either compared (determined to be equal or not equal) or ignored and reporte
(r interface {
// PushStep is called when a tree-traversal operation is performed.
// The PathStep itself is only valid until the step is popped.
// The PathStep.Values are valid for the duration of the entire traversal
// and must not be mutated.
//
// Equal always calls PushStep at the start to provide an operation-less
// PathStep used to report the root values.
//
// Within a slice, the exact set of inserted, removed, or modified elements
// is unspecified and may change in future implementations.
// The entries of a map are iterated through in an unspecified order.
PushStep(PathStep)
// Report is called exactly once on leaf nodes to report whether the
// comparison identified the node as equal, unequal, or ignored.
// A leaf node is one that is immediately preceded by and followed by
// a pair of PushStep and PopStep calls.
Report(Result)
// PopStep ascends back up the value tree.
// There is always a matching pop call for every push call.
PopStep()
})
| 492 | // either compared (determined to be equal or not equal) or ignored and reported |
| 493 | // as such by calling the Report method. |
| 494 | func Reporter(r interface { |
| 495 | // PushStep is called when a tree-traversal operation is performed. |
| 496 | // The PathStep itself is only valid until the step is popped. |
| 497 | // The PathStep.Values are valid for the duration of the entire traversal |
| 498 | // and must not be mutated. |
| 499 | // |
| 500 | // Equal always calls PushStep at the start to provide an operation-less |
| 501 | // PathStep used to report the root values. |
| 502 | // |
| 503 | // Within a slice, the exact set of inserted, removed, or modified elements |
| 504 | // is unspecified and may change in future implementations. |
| 505 | // The entries of a map are iterated through in an unspecified order. |
| 506 | PushStep(PathStep) |
| 507 | |
| 508 | // Report is called exactly once on leaf nodes to report whether the |
| 509 | // comparison identified the node as equal, unequal, or ignored. |
| 510 | // A leaf node is one that is immediately preceded by and followed by |
| 511 | // a pair of PushStep and PopStep calls. |
| 512 | Report(Result) |
| 513 | |
| 514 | // PopStep ascends back up the value tree. |
| 515 | // There is always a matching pop call for every push call. |
| 516 | PopStep() |
| 517 | }) Option { |
| 518 | return reporter{r} |
| 519 | } |
| 520 | |
| 521 | type reporter struct{ reporterIface } |
| 522 | type reporterIface interface { |
no outgoing calls