-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Description
Proposal Details
This proposal aims at making a user-implementable version of net.Buffers.
Add a new interface to io and implement it on net.* which implement net.buffersWriter:
type ManyWriter interface {
// WriteMany has the same semantics as appending the buffers back to back into one buffer and calling [Writer.Write] method,
// but it allows to remove the need to allocate and copy all the buffers in one contiguous memory region.
// The implementation cannot write to any of the passed buffer or buffers slice.
WriteMany(...[]byte) (n int64, err error)
}note: this return int64 because it would be easy to build let's say 16GiB buffer on a 32bits pointer architecture by having the byte arrays alias each other.
(*net.Buffers).WriteTo would also check if the underlying implementation supports io.ManyWriter as well as net.buffersWriter.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Incoming