UNPKG

@microsoft/dev-tunnels-ssh

Version:
43 lines 1.44 kB
/** * Generic iterable queue implementation using an auto-expanding circular array buffer. * Designed to be more efficient for high-volume use compared to a simpler JS queue using * `Array.shift()` (which would cause a lot of allocations). */ export declare class Queue<T> implements Iterable<T> { private array; private first; private count; /** * The version is incremented upon any changes to the queue, so that any iterators can detect the * change and become invalid. `MAX_SAFE_INTEGER` is 2^53-1 so this isn't likely to ever overflow. */ private version; /** * Gets the current size of the queue. */ get size(): number; /** * Adds an item to the end of the queue. */ enqueue(item: T): void; /** * Removes an item from the front of the queue. * @returns The removed item, or `undefined` if the queue is empty. */ dequeue(): T | undefined; /** * Gets the item at the front of the queue without removing it. * @returns The front item, or `undefined` if the queue is empty. */ peek(): T | undefined; /** * Clears the queue. */ clear(): void; /** * Creates an iterator over the items in the queue. * (Any changes to the queue will invalidate the iterator.) */ [Symbol.iterator](): Iterator<T>; } //# sourceMappingURL=queue.d.ts.map