Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrClosed is returned when Write is called on a closed BytesPipe. ErrClosed = errors.New("write to closed BytesPipe") )
Functions ¶
This section is empty.
Types ¶
type BytesPipe ¶
type BytesPipe struct {
// contains filtered or unexported fields
}
BytesPipe is io.ReadWriteCloser which works similarly to pipe(queue). All written data may be read at most once. Also, BytesPipe allocates and releases new byte slices to adjust to current needs, so the buffer won't be overgrown after peak loads.
func New ¶
func New() *BytesPipe
New creates new BytesPipe, initialized by specified slice. If buf is nil, then it will be initialized with slice which cap is 64. buf will be adjusted in a way that len(buf) == 0, cap(buf) == cap(buf).
func (*BytesPipe) CloseWithError ¶
CloseWithError causes further reads from a BytesPipe to return immediately.
Click to show internal directories.
Click to hide internal directories.