Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Buffer.WriteByte and WriteString methods #691

Merged
merged 2 commits into from Jun 24, 2021

Commits on Mar 25, 2019

  1. Add Buffer.WriteByte and WriteString methods

    These methods are equivalent to `AppendByte` and `AppendString`, but
    their signatures are compatible with
    [bytes.Buffer](https://godoc.org/bytes#Buffer) and
    [bufio.Writer](https://godoc.org/bufio#Writer).
    
    This allows to use `Buffer` where `bytes.Buffer` was expected without
    extra cost of wrapping. One example is msgpack library which
    expects `Writer` to implement `WriteByte` and `WriteString`, otherwise
    it is wrapped which incurs extra allocation:
    https://github.com/vmihailenco/msgpack/blob/master/encode.go#L63-L67
    smira committed Mar 25, 2019
    Copy the full SHA
    5640fd8 View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2021

  1. Copy the full SHA
    3c8c05c View commit details
    Browse the repository at this point in the history