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)
| 142 | // 'buf' is not used when the capacity is smaller than 18, |
| 143 | // custom buffer is allocated instead. |
| 144 | func 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. |
| 156 | func Encode(w io.Writer, e Encodable) error { |
no outgoing calls
no test coverage detected
searching dependent graphs…