NewPool constructs a new Pool.
()
| 31 | |
| 32 | // NewPool constructs a new Pool. |
| 33 | func NewPool() Pool { |
| 34 | return Pool{ |
| 35 | p: pool.New(func() *Buffer { |
| 36 | return &Buffer{ |
| 37 | bs: make([]byte, 0, _size), |
| 38 | } |
| 39 | }), |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // Get retrieves a Buffer from the pool, creating one if necessary. |
| 44 | func (p Pool) Get() *Buffer { |