func (c *cNode) getBranches(word string) (*branch, *branch) {
	return c.branches[word], c.branches[wildcard]
}
getBranches returns the branches for the given word. There are two possible
branches: exact match and single wildcard.
package hub
import (
	"strings"
	"sync/atomic"
	"unsafe"
)
type iNode struct {
	main *mainNode
}
type mainNode struct {
	cNode *cNode
	tNode *tNode
}
type cNode struct {
	branches map[string]*branch
}
func newCNode(words []string, sub subscriber) *cNode {
	if len(words) == 1 {
		return &cNode{
			branches: map[string]*branch{
				words[0]: {subs: map[subscriber]struct{}{sub: {}}},
			},
		}
	}
	nin := &iNode{main: &mainNode{cNode: newCNode(words[1:], sub)}}
	return &cNode{
		branches: map[string]*branch{
			words[0]: {subs: map[subscriber]struct{}{}, iNode: nin},
		},
	}
}
func (c *cNode) inserted(words []string, sub subscriber) *cNode {
	branches := make(map[string]*branch, len(c.branches)+1)
	for key, branch := range c.branches {
		branches[key] = branch
	}
	var br *branch
	if len(words) == 1 {
		br = &branch{subs: map[subscriber]struct{}{sub: {}}}
	} else {
		br = &branch{
			subs:  make(map[subscriber]struct{}),
			iNode: &iNode{main: &mainNode{cNode: newCNode(words[1:], sub)}},
		}
	}
	branches[words[0]] = br
	return &cNode{branches: branches}
}
func (c *cNode) updated(word string, sub subscriber) *cNode {
	branches := make(map[string]*branch, len(c.branches))
	for word, branch := range c.branches {
		branches[word] = branch
	}
	newBranch := &branch{subs: map[subscriber]struct{}{sub: {}}}
	br, ok := branches[word]
	if ok {
		for id, sub := range br.subs {
			newBranch.subs[id] = sub
		}
		newBranch.iNode = br.iNode
	}
	branches[word] = newBranch
	return &cNode{branches: branches}
}
func (c *cNode) updatedBranch(word string, in *iNode, br *branch) *cNode {
	branches := make(map[string]*branch, len(c.branches))
	for key, branch := range c.branches {
		branches[key] = branch
	}
	branches[word] = br.updated(in)
	return &cNode{branches: branches}
}
func (c *cNode) removed(word string, sub subscriber) *cNode {
	branches := make(map[string]*branch, len(c.branches))
	for word, branch := range c.branches {
		branches[word] = branch
	}
	br, ok := branches[word]
	if ok {
		br = br.removed(sub)
		if len(br.subs) == 0 && br.iNode == nil {
			delete(branches, word)
		} else {
			branches[word] = br
		}
	}
	return &cNode{branches: branches}
}