4 * An allocator as used by {@link util.pool}.
\r
5 * @typedef PoolAllocator
\r
7 * @param {number} size Buffer size
\r
8 * @returns {Uint8Array} Buffer
\r
10 type PoolAllocator = (size: number) => Uint8Array;
\r
13 * A slicer as used by {@link util.pool}.
\r
14 * @typedef PoolSlicer
\r
16 * @param {number} start Start offset
\r
17 * @param {number} end End offset
\r
18 * @returns {Uint8Array} Buffer slice
\r
19 * @this {Uint8Array}
\r
21 type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array;
\r
24 * A general purpose buffer pool.
\r
27 * @param {PoolAllocator} alloc Allocator
\r
28 * @param {PoolSlicer} slice Slicer
\r
29 * @param {number} [size=8192] Slab size
\r
30 * @returns {PoolAllocator} Pooled allocator
\r
32 declare function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator;
\r