{"modulePath":"github.com/hyperhq/hypercli","version":"v1.10.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package pools\n\nPackage pools provides a collection of pools which provide various data types with buffers. These can be used to lower the number of memory allocations and reuse buffers.\n\nNew pools should be added to this package to allow them to be shared across packages.\n\nUtility functions which operate on pools should be added to this package to allow them to be reused.\n\n## Variables\n\n```go\nvar (\n\t// BufioReader32KPool is a pool which returns bufio.Reader with a 32K buffer.\n\tBufioReader32KPool *BufioReaderPool\n\t// BufioWriter32KPool is a pool which returns bufio.Writer with a 32K buffer.\n\tBufioWriter32KPool *BufioWriterPool\n)\n```\n\n## Functions\n\n```go\nfunc Copy(dst io.Writer, src io.Reader) (written int64, err error)\n```\nCopy is a convenience wrapper which uses a buffer to avoid allocation in io.Copy.\n\n## Types\n\n```go\ntype BufioReaderPool struct {\n\t// contains filtered or unexported fields\n}\n```\nBufioReaderPool is a bufio reader that uses sync.Pool.\n\n```go\nfunc (bufPool *BufioReaderPool) Get(r io.Reader) *bufio.Reader\n```\nGet returns a bufio.Reader which reads from r. The buffer size is that of the pool.\n\n```go\nfunc (bufPool *BufioReaderPool) NewReadCloserWrapper(buf *bufio.Reader, r io.Reader) io.ReadCloser\n```\nNewReadCloserWrapper returns a wrapper which puts the bufio.Reader back into the pool and closes the reader if it's an io.ReadCloser.\n\n```go\nfunc (bufPool *BufioReaderPool) Put(b *bufio.Reader)\n```\nPut puts the bufio.Reader back into the pool.\n\n```go\ntype BufioWriterPool struct {\n\t// contains filtered or unexported fields\n}\n```\nBufioWriterPool is a bufio writer that uses sync.Pool.\n\n```go\nfunc (bufPool *BufioWriterPool) Get(w io.Writer) *bufio.Writer\n```\nGet returns a bufio.Writer which writes to w. The buffer size is that of the pool.\n\n```go\nfunc (bufPool *BufioWriterPool) NewWriteCloserWrapper(buf *bufio.Writer, w io.Writer) io.WriteCloser\n```\nNewWriteCloserWrapper returns a wrapper which puts the bufio.Writer back into the pool and closes the writer if it's an io.Writecloser.\n\n```go\nfunc (bufPool *BufioWriterPool) Put(b *bufio.Writer)\n```\nPut puts the bufio.Writer back into the pool.\n\n","path":"github.com/hyperhq/hypercli/pkg/pools","name":"pools","synopsis":"Package pools provides a collection of pools which provide various data types with buffers.","isRedistributable":true}
