package encoding import "bytes" type ASCIICoder struct{} func (c *ASCIICoder) Encode(s *string, buf *bytes.Buffer) error { // These should be ASCII but UTF8 is a superset of ASCII so hopefully this'll be fine buf.WriteString(*s) return nil } func (c *ASCIICoder) Decode(buf *bytes.Buffer) (string, error) { return buf.String(), nil } func (c ASCIICoder) EncodesInto(s *string) int { return len(*s) } func (c ASCIICoder) DecodesInto(buf *bytes.Buffer) int { return buf.Len() }