MCPcopy Create free account
hub / github.com/bobg/hashsplit / Root

Function Root

hashsplit.go:318–324  ·  view source on GitHub ↗

Root takes the output of [Tree] and returns the root of the tree. It does this by consuming the iterator and returning the last node, discarding everything else.

(tree iter.Seq2[*TreeNode, int])

Source from the content-addressed store, hash-verified

316// It does this by consuming the iterator and returning the last node,
317// discarding everything else.
318func Root(tree iter.Seq2[*TreeNode, int]) *TreeNode {
319 var root *TreeNode
320 for node := range tree {
321 root = node
322 }
323 return root
324}
325
326// TreeNode is the type of a node in the tree produced by [Tree].
327type TreeNode struct {

Callers 1

buildTreeFunction · 0.85

Calls

no outgoing calls

Tested by 1

buildTreeFunction · 0.68