MCPcopy Index your code
hub / github.com/cockroachdb/redact / WriteString

Method WriteString

internal/buffer/buffer.go:143–150  ·  view source on GitHub ↗

WriteString appends the contents of s to the buffer, growing the buffer as needed. The return value n is the length of s; err is always nil. If the buffer becomes too large, WriteString will panic with ErrTooLarge.

(s string)

Source from the content-addressed store, hash-verified

141// needed. The return value n is the length of s; err is always nil. If the
142// buffer becomes too large, WriteString will panic with ErrTooLarge.
143func (b *Buffer) WriteString(s string) (n int, err error) {
144 b.startWrite()
145 m, ok := b.tryGrowByReslice(len(s))
146 if !ok {
147 m = b.grow(len(s))
148 }
149 return copy(b.buf[m:], s), nil
150}
151
152// WriteByte emits a single byte.
153func (b *Buffer) WriteByte(s byte) error {

Callers 8

FormatMethod · 0.95
TestBufferUnsafeWritesFunction · 0.95
TestBufferRawSafeWritesFunction · 0.95
Example_newlinesFunction · 0.95
Example_mixed_writesFunction · 0.95
WriteByteMethod · 0.95

Calls 3

startWriteMethod · 0.95
tryGrowByResliceMethod · 0.95
growMethod · 0.95

Tested by 7

FormatMethod · 0.76
TestBufferUnsafeWritesFunction · 0.76
TestBufferRawSafeWritesFunction · 0.76
Example_newlinesFunction · 0.76
Example_mixed_writesFunction · 0.76