Refactor encoding to use *string instead of string as input

I don't want to clone the whole input string
This commit is contained in:
2024-07-31 12:58:02 +02:00
parent 7b4fcf3de1
commit 7001f2c51a
5 changed files with 19 additions and 18 deletions

View File

@@ -4,8 +4,9 @@ import "bytes"
type ASCIICoder struct{}
func (c *ASCIICoder) Encode(s string, buf *bytes.Buffer) error {
buf.WriteString(s)
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
}