mogami-stream - v0.4.0
    Preparing search index...

    Interface StreamIterator<T>

    An AsyncIterableIterator with explicit cancellation control and a closed lifecycle promise. Completion covers work owned by this iterator. A branch iterator owns only its endpoint; shared source work and cleanup belong to its BranchGroup.

    interface StreamIterator<T> {
        closed: Promise<CloseReport>;
        "[asyncIterator]"(): AsyncIterableIterator<T, unknown, undefined>;
        cancel(reason?: unknown): void;
        next(
            ...__namedParameters: [] | [undefined],
        ): Promise<IteratorResult<T, unknown>>;
        return(value?: unknown): Promise<IteratorResult<T, unknown>>;
        throw(error?: unknown): Promise<IteratorResult<T, unknown>>;
    }

    Type Parameters

    • T

    Hierarchy

    • AsyncIterableIterator<T, unknown, undefined>
      • StreamIterator
    Index
    closed: Promise<CloseReport>

    Resolves with a CloseReport once owned upstream iterators and finalizers have finished. Branch iterators resolve when their endpoint finishes, without waiting for shared source cleanup. Never rejects, and awaiting it does not trigger cancellation.

    • Returns AsyncIterableIterator<T, unknown, undefined>

    • Immediately requests cancellation without waiting for cleanup. Track teardown completion via closed.

      Parameters

      • Optionalreason: unknown

      Returns void

    • Parameters

      • ...__namedParameters: [] | [undefined]

      Returns Promise<IteratorResult<T, unknown>>

    • Stops the owned execution and waits for its cleanup before resolving { done: true, value: undefined }. Rejects with the primary reason if the execution failed, including cleanup-only failure. After cancellation, resolves even if cleanup fails; inspect closed for suppressed errors.

      Parameters

      • Optionalvalue: unknown

      Returns Promise<IteratorResult<T, unknown>>

    • Requests failure without forwarding the throw into the upstream iterator and rejects immediately, without waiting for cleanup. Preserves an existing failure or cancellation reason; await closed for teardown completion.

      Parameters

      • Optionalerror: unknown

      Returns Promise<IteratorResult<T, unknown>>