github.com/searKing/golang/go@v1.2.117/container/trie_tree/ternary_search_tree/handler.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package ternary_search_tree 6 7 type Handler interface { 8 Handle(prefix []byte, value any) (goon bool) 9 } 10 11 // The HandlerFunc type is an adapter to allow the use of 12 // ordinary functions as traversal handlers. If f is a function 13 // with the appropriate signature, HandlerFunc(f) is a 14 // Handler that calls f. 15 type HandlerFunc func(prefix []byte, value any) (goon bool) 16 17 // ServeHTTP calls f(w, r). 18 func (f HandlerFunc) Handle(prefix []byte, value any) (goon bool) { 19 return f(prefix, value) 20 }