// ets_tracing: off import * as Q from "../../../../Queue/index.js" import * as C from "../core.js" import * as Ensuring from "./ensuring.js" import * as FromQueue from "./fromQueue.js" /** * Creates a stream from a queue of values. The queue will be shutdown once the stream is closed. * * @param maxChunkSize Maximum number of queued elements to put in one chunk in the stream */ export function fromQueueWithShutdown_( queue: Q.XQueue, maxChunkSize = C.DEFAULT_CHUNK_SIZE ): C.Stream { return Ensuring.ensuring_( FromQueue.fromQueue_(queue, maxChunkSize), Q.shutdown(queue) ) } /** * Creates a stream from a queue of values. The queue will be shutdown once the stream is closed. * * @param maxChunkSize Maximum number of queued elements to put in one chunk in the stream * * @ets_data_first fromQueueWithShutdown_ */ export function fromQueueWithShutdown(maxChunkSize = C.DEFAULT_CHUNK_SIZE) { return (queue: Q.XQueue) => fromQueueWithShutdown_(queue, maxChunkSize) }