func (t *Tree) WalkPath(path string, fn WalkFn) {
	n := t.root
	search := path
	for {
		// Visit the leaf values if any
		if n.leaf != nil && fn(n.leaf.key, n.leaf.val) {
			return
		}

		// Check for key exhaution
		if len(search) == 0 {
			return
		}

		// Look for an edge
		n = n.getEdge(search[0])
		if n == nil {
			return
		}

		// Consume the search prefix
		if strings.HasPrefix(search, n.prefix) {
			search = search[len(n.prefix):]
		} else {
			break
		}
	}
}
func (t *Tree) WalkPath(path string, fn WalkFn) {
	n := t.root
	search := path
	for {
		
		if n.leaf != nil && fn(n.leaf.key, n.leaf.val) {
			return
		}

		
		if len(search) == 0 {
			return
		}

		
		n = n.getEdge(search[0])
		if n == nil {
			return
		}

		
		if strings.HasPrefix(search, n.prefix) {
			search = search[len(n.prefix):]
		} else {
			break
		}
	}
}
func ( t * Tree ) WalkPath ( path string , fn WalkFn ) { n := t . root search := path for { // Visit the leaf values if any if n . leaf != nil && fn ( n . leaf . key , n . leaf . val ) { return } // Check for key exhaution if len ( search ) == 0 { return } // Look for an edge n = n . getEdge ( search [ 0 ] ) if n == nil { return } // Consume the search prefix if strings . HasPrefix ( search , n . prefix ) { search = search [ len ( n . prefix ) : ] } else { break } } }
// WalkPath is used to walk the tree, but only visiting nodes
// from the root down to a given leaf. Where WalkPrefix walks
// all the entries *under* the given prefix, this walks the
// entries *above* the given prefix.
WalkPath is used to walk the tree but only visiting nodes from the root down to a given leaf . Where WalkPrefix walks all the entries * under * the given prefix this walks the entries * above * the given prefix .