MCPcopy Create free account
hub / github.com/cloudwego/netpoll / WriteDirect

Method WriteDirect

nocopy.go:172–172  ·  view source on GitHub ↗

WriteDirect is used to insert an additional slice of data on the current write stream. For example, if you plan to execute: var bufA, _ = Malloc(nA) WriteBinary(b) var bufB, _ = Malloc(nB) It can be replaced by: var buf, _ = Malloc(nA+nB) WriteDirect(b, nB) where buf[:nA] = bufA, buf[nA:nA+nB] =

(p []byte, remainCap int)

Source from the content-addressed store, hash-verified

170 //
171 // where buf[:nA] = bufA, buf[nA:nA+nB] = bufB.
172 WriteDirect(p []byte, remainCap int) error
173
174 // MallocAck will keep the first n malloc bytes and discard the rest.
175 // The following behavior:

Callers 6

WriteDirectMethod · 0.65
WriteDirectMethod · 0.65
TestMallocAckFunction · 0.65
WriteDirectMethod · 0.65

Implementers 4

zcWriternocopy_readwriter.go
UnsafeLinkBuffernocopy_linkbuffer.go
SafeLinkBuffernocopy_linkbuffer_race.go
connectionconnection_impl.go

Calls

no outgoing calls

Tested by 3

TestMallocAckFunction · 0.52