func (s Stats) CollectNamed(statName string) Stats {
	return s.Collect(func(e Stat) bool {
		return e.Stat == statName
	})
}
CollectNamed returns all data sent for a given stat name.
package statsdtest
import (
	"bytes"
	"fmt"
	"strings"
)
type Stat struct {
	Raw    []byte
	Stat   string
	Value  string
	Tag    string
	Rate   string
	Parsed bool
}
func (s *Stat) String() string {
	return fmt.Sprintf("%s %s %s", s.Stat, s.Value, s.Rate)
}
func ParseStats(src []byte) Stats {
	d := make([]byte, len(src))
	copy(d, src)
	entries := bytes.Split(d, []byte{'\n'})
	result := make(Stats, len(entries))
	for i, e := range entries {
		result[i] = Stat{Raw: e}
		ss := &result[i]
		marker := bytes.IndexByte(e, ':')
		if marker == -1 {
			continue
		}
		ss.Stat = string(e[0:marker])
		e = e[marker+1:]
		marker = bytes.IndexByte(e, '|')
		if marker == -1 {
			continue
		}
		ss.Value = string(e[:marker])
		e = e[marker+1:]
		marker = bytes.IndexByte(e, '|')
		if marker == -1 {
			ss.Tag = string(e)
		} else {
			ss.Tag = string(e[:marker])
			e = e[marker+1:]
			if len(e) == 0 || e[0] != '@' {
				continue
			}
			ss.Rate = string(e[1:])
		}
		ss.Parsed = true
	}
	return result
}
type Stats []Stat
func (s Stats) Unparsed() Stats {
	var r Stats
	for _, e := range s {
		if !e.Parsed {
			r = append(r, e)
		}
	}
	return r
}