UNPKG

@thi.ng/buffers

Version:

General purpose and generic read/write buffer implementations with different behaviors/orderings

21 lines 704 B
import { FIFOBuffer } from "./fifo.js"; /** * Returns a {@link SlidingBuffer} ring buffer with given max. capacity. * * @remarks * With this implementation, writes are **always** possible, but not guaranteed * to happen: Whilst the buffer is at full capacity, new writes will first * expunge the oldest buffered value. Read behavior is the same as for * {@link fifo}. * * Also see {@link dropping} for alternative behavior. * * @param cap */ export declare const sliding: <T>(cap: number) => SlidingBuffer<T>; export declare class SlidingBuffer<T> extends FIFOBuffer<T> { copy(): SlidingBuffer<T>; writable(): boolean; write(x: T): boolean; } //# sourceMappingURL=sliding.d.ts.map