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

Method require

msgp/write.go:197–208  ·  view source on GitHub ↗

NOTE: this should only be called with a number that is guaranteed to be less than len(mw.buf). typically, it is called with a constant. NOTE: this is a hot code path

(n int)

Source from the content-addressed store, hash-verified

195//
196// NOTE: this is a hot code path
197func (mw *Writer) require(n int) (int, error) {
198 c := len(mw.buf)
199 wl := mw.wloc
200 if c-wl < n {
201 if err := mw.flush(); err != nil {
202 return 0, err
203 }
204 wl = mw.wloc
205 }
206 mw.wloc += n
207 return wl, nil
208}
209
210func (mw *Writer) Append(b ...byte) error {
211 if mw.avail() < len(b) {

Callers 6

writeExtensionHeaderMethod · 0.95
WriteExtensionMethod · 0.95
WriteComplex64Method · 0.95
WriteComplex128Method · 0.95
WriteTimeMethod · 0.95
WriteTimeExtMethod · 0.95

Calls 1

flushMethod · 0.95

Tested by

no test coverage detected