Closed
Description
We have
// SkipAndReturnBytes skip next JSON element, and return its content as []byte.
// The []byte can be kept, it is a copy of data.
func (iter *Iterator) SkipAndReturnBytes() []byte {
iter.startCapture(iter.head)
iter.Skip()
return
}
I propose something like that:
// AppendSkip skips next JSON element and appends its content to
// buffer, returning the result.
func (iter *Iterator) AppendSkip(buf []byte) []byte {
return append(buf, iter.SkipAndReturnBytes()...)
}
Obviously, the internal implementation will differ and will not allocate a new slice.
It is like Time.AppendFormat
, but for SkipAndReturnBytes
.
This will allow allocation optimizations in case of concurrent parsing.
If you are interested in such implementation, I can prepare a PR.
Metadata
Metadata
Assignees
Labels
No labels