GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
873 B

2 months ago
  1. export = pool;
  2. /**
  3. * An allocator as used by {@link util.pool}.
  4. * @typedef PoolAllocator
  5. * @type {function}
  6. * @param {number} size Buffer size
  7. * @returns {Uint8Array} Buffer
  8. */
  9. type PoolAllocator = (size: number) => Uint8Array;
  10. /**
  11. * A slicer as used by {@link util.pool}.
  12. * @typedef PoolSlicer
  13. * @type {function}
  14. * @param {number} start Start offset
  15. * @param {number} end End offset
  16. * @returns {Uint8Array} Buffer slice
  17. * @this {Uint8Array}
  18. */
  19. type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array;
  20. /**
  21. * A general purpose buffer pool.
  22. * @memberof util
  23. * @function
  24. * @param {PoolAllocator} alloc Allocator
  25. * @param {PoolSlicer} slice Slicer
  26. * @param {number} [size=8192] Slab size
  27. * @returns {PoolAllocator} Pooled allocator
  28. */
  29. declare function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator;