github.com/nebulouslabs/sia@v1.3.7/modules/renter/hostdb/hosttree/sort.go (about) 1 package hosttree 2 3 type byWeight []hostEntry 4 5 func (he byWeight) Len() int { return len(he) } 6 func (he byWeight) Less(i, j int) bool { return he[i].weight.Cmp(he[j].weight) < 0 } 7 func (he byWeight) Swap(i, j int) { he[i], he[j] = he[j], he[i] }