MCPcopy
hub / github.com/tinylib/msgp / NewWriterBuf

Function NewWriterBuf

msgp/write.go:144–153  ·  view source on GitHub ↗

NewWriterBuf returns a writer with a provided buffer. 'buf' is not used when the capacity is smaller than 18, custom buffer is allocated instead.

(w io.Writer, buf []byte)

Source from the content-addressed store, hash-verified

142// 'buf' is not used when the capacity is smaller than 18,
143// custom buffer is allocated instead.
144func NewWriterBuf(w io.Writer, buf []byte) *Writer {
145 if cap(buf) < minWriterSize {
146 buf = make([]byte, minWriterSize)
147 }
148 buf = buf[:cap(buf)]
149 return &Writer{
150 w: w,
151 buf: buf,
152 }
153}
154
155// Encode encodes an Encodable to an io.Writer.
156func Encode(w io.Writer, e Encodable) error {

Callers 1

NewWriterSizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…