import type * as TY from '../types.ts';
export declare function keyStar(obj: any[]): Generator<number, any, number | undefined>;
export declare function keyStar<VT extends object, KT extends keyof VT = keyof VT>(obj: VT): Generator<KT, any, KT | undefined>;
export declare function valuesStar<IT>(obj: IT[]): Generator<IT, any, IT | undefined>;
export declare function valuesStar<VT extends object, KT extends keyof VT = keyof VT>(obj: VT): Generator<VT[KT], any, VT[KT] | undefined>;
export declare function entriesStar<IT>(obj: IT[]): Generator<[number, IT, number], any, [number, IT, number] | undefined>;
export declare function entriesStar<VT extends object, KT extends keyof VT = keyof VT>(obj: VT): Generator<[KT, VT[KT], number], any, [KT, VT[KT], number] | undefined>;
export declare function classifyIterable(obj: any): false | 'iterable' | 'iterator' | 'asyncIterator';
export declare function isAnyIter<IT>(obj: any): obj is Iterator<IT> | AsyncIterator<IT> | Iterable<IT> | AsyncIterable<IT>;
/** @returns true if `obj` is a sync iterable -- @see {@link isAsyncIterable}, {@link iteratorFor} */
export declare function isSyncIterable<IT>(obj: any): obj is Iterable<IT>;
/** @returns true if `obj` is an async iterable  -- @see {@link isSyncIterable}, {@link asyncIteratorFor} */
export declare function isAsyncIterable<IT>(obj: any): obj is AsyncIterable<IT>;
/** yields objects from the beg'th to the end'th index, using the same sematics as @see {@link Array.slice}.
 * NOTE: if either index is negative, and you do not provide a length, this will have to buffer some or all of the
 * result set (though not the entire input set), as we won't know when the indices have been reached.
 */
export declare function sliceStar<IT>(obj: Iterable<IT>, beg?: number | undefined, end?: number | undefined, opts?: {
    len?: number | undefined;
    treatAs?: 'stream' | undefined;
}): Generator<IT, any, IT | undefined>;
export declare function sliceStar<VT extends object, KT extends keyof VT = keyof VT>(obj: VT, beg?: number | undefined, end?: number | undefined, opts?: {
    len?: number | undefined;
    treatAs?: 'object' | undefined;
}): Generator<VT[KT], any, VT[KT] | undefined>;
/** yields objects from the beg'th to the end'th index, using the same sematics as @see {@link Array.slice}.
 * NOTE: if either index is negative, and you do not provide a length, this will have to buffer some or all of the
 * result set (though not the entire input set), as we won't know when the indices have been reached.
 */
export declare function sliceStream<IT>(stream: Iterable<IT>, arg0?: number | undefined, arg1?: number | undefined, len?: number | undefined): Generator<IT, any, IT | undefined>;
/** Return items starting from the beg'th index and ending at the end'th index
 *
 * Ensure that `items` is not an array, is sync iterable,
 * has beg >= 0, and end > beg.
 *
 */
export declare function _sliceStarPosPos<IT>(stream: Iterable<IT>, beg: number, end: number): Generator<IT, any, IT | undefined>;
/** Keep at most the last `horizon` items in the stream, additionally dropping the last `dropend` of them
 * NOTE: this will have to buffer some or all of the result set:
 * * buffer size: `horizon` -- (or stream length, if less)
 * * result size: `min(horizon, stream len, horizon + dropend - len)`
 *
 * Ensure that `items` is not an array, is sync iterable, if horizon >= 0, and if dropend > 0
 *
 * Strategy: examine all items
 * * push each item into the buffer
 * * if seq > horizon, shift and discard the first item; it will be too old
 *   the buffer will be at most `horizon` items
 * once the stream is exhausted,
 * yield * all but the last `dropend` items in the buffer
 */
export declare function _sliceStarNegNeg<VT>(items: Iterable<VT>, horizon: number, dropend: number): Generator<VT, any, VT | undefined>;
/** Yield items starting from the beg'th index, but always omitting the last `dropend` items.
 * Unless more than `dropend` items are available, none will be streamed.
 * NOTE: this will have to buffer some or all of the result set:
 * * buffer size: `dropend`
 * * result size: `len - dropend - beg` -- if negative, none will be streamed
 *
 * Ensure that `items` is not an array, is sync iterable, if beg >= 0, and if omit > 0
 *
 * * ignore the first `beg` items
 * * push each item after that into the buffer
 * * if more than `dropend` items are in the buffer,
 *   shift+yield the earliest item. (the buffer stops growing at this point)
 * * once the end is reached, the buffer (holding the last `dropend` items) is discarded
 */
export declare function _sliceStarPosNeg<VT>(items: Iterable<VT>, beg: number, dropend: number): Generator<VT, any, VT | undefined>;
/** Yield items starting from the horizon'th before the end,
 * but always stopping at and discarding the end'th item.
 * This will have to buffer up to `horizon` items:
 * * buffer size: `horizon`
 * * result size: `min([horizon, len, horizon + len - end])` -- if negative, none will be streamed
 *
 * Ensure that `items` is not an array, is sync iterable,
 * has horizon > 0, and end > 0.
 *
 * 0123456789 horz endx  len  begx  stopx  01234 56789
 * ABCDEFGHIJ    3   12   10   7      9    xxxxx xxHIJ
 * ABCDEFGHIJ    3 >=10   10   7      9    xxxxx xxHIJ
 * ABCDEFGHIJ    3    9   10   7      8    xxxxx xxHIx
 * ABCDEFGHIJ    3    8   10   7      7    xxxxx xxHxx
 * ABCDEFGHIJ    8 >=10   10   2      9    xxCDE FGHIJ
 * ABCDEFGHIJ    8    4   10   2      4    xxCDx xxxxx
 * ABCDEFGHIJ   10 >=10   10   0      9    ABCDE FGHIJ
 * ABCDEFGHIJ   10    9   10   0      8    ABCDE FGHIx
 * ABCDEFGHIJ    3    4   10   2      4    xxCDE xxxxx
 * ABCD          3    4    4   1      3    xBCD
 * ABCD          4   10    4   1      3    xBCD
 * ABC           3    4    3   0      2    ABC
 * A             3    4    1   0      0    A
 * ABCDEFGHIJ    3    3                    (not a valid call)
 *
 * Strategy:
 * * if seq < end, push the item (it might age out later)
 * * if seq > horizon, shift the first item; it will be too old
 * * if seq > end + horizon, break.
 * yield * all the items in the buffer (we'll have already
 * aged out those past the horizon, and never added the ones past the end)
 *
 */
export declare function _sliceStarNegPos<VT>(items: Iterable<VT>, horizon: number, end: number): Generator<VT, any, VT | undefined>;
/** @returns an array of all the values in the iterable; works if iterable is async or sync */
export declare function slurp<VT>(iter: AsyncIterable<VT> | Iterable<VT>): Promise<VT[]>;
export declare function iteratorFor<VT>(iter: TY.AnySyncIterable<VT>): Iterator<VT>;
export declare function iteratorFor<VT>(iter: TY.AnyAsyncIterable<VT> | TY.AnySyncIterable<VT>): AsyncIterator<VT> | Iterator<VT>;
/** @returns an array of all the values in the iterable */
export declare function slurpWithResult<VT, RT = any>(streamable: TY.AnyAsyncIterable<VT, RT> | TY.AnySyncIterable<VT, RT>): Promise<{
    vals: VT[];
    ret: RT;
}>;
/** @returns an array of all the values in the iterable */
export declare function slurpWithResultSync<VT, RT = any>(streamable: TY.AnySyncIterable<VT, RT>): {
    vals: VT[];
    ret: RT;
};
//# sourceMappingURL=Streaming.d.ts.map