@thi.ng/buffers
Version:
General purpose and generic read/write buffer implementations with different behaviors/orderings
20 lines • 686 B
TypeScript
import { FIFOBuffer } from "./fifo.js";
/**
* Returns a {@link DroppingBuffer} 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 be silently
* ignored. Read behavior is the same as for {@link fifo}.
*
* Also see {@link sliding} for alternative behavior.
*
* @param cap
*/
export declare const dropping: <T>(cap: number) => DroppingBuffer<T>;
export declare class DroppingBuffer<T> extends FIFOBuffer<T> {
copy(): DroppingBuffer<T>;
writable(): boolean;
write(x: T): boolean;
}
//# sourceMappingURL=dropping.d.ts.map