pub fn new_batcher<I, T, E>(
    items: I,
    stats: Arc<BatchIteratorConnectionStats>,
    mode: StreamMode,
) -> FormattedStream
where
    I: Stream<Item = Result<T, E>> + Send + 'static,
    T: Into<FormattedContent> + Send,
    E: Into<AccessorError> + Send,
{
    match mode {
        StreamMode::Subscribe | StreamMode::SnapshotThenSubscribe => {
            Box::pin(FormattedContentBatcher {
                items: items.ready_chunks(MAXIMUM_ENTRIES_PER_BATCH as _),
                stats,
            })
        }
        StreamMode::Snapshot => Box::pin(FormattedContentBatcher {
            items: items.chunks(MAXIMUM_ENTRIES_PER_BATCH as _),
            stats,
        }),
    }
}
/// Make a new `FormattedContentBatcher` with a chunking strategy depending on stream mode.
///
/// In snapshot mode, batched items will not be flushed to the client until the batch is complete
/// or the underlying stream has terminated.
///
/// In subscribe or snapshot-then-subscribe mode, batched items will be flushed whenever the
/// underlying stream is pending, ensuring clients always receive latest results.
Make a new `FormattedContentBatcher` with a chunking strategy depending on stream mode.
In snapshot mode, batched items will not be flushed to the client until the batch is complete
or the underlying stream has terminated.

In subscribe or snapshot-then-subscribe mode, batched items will be flushed whenever the
underlying stream is pending, ensuring clients always receive latest results.
Make a new ` FormattedContentBatcher ` with a chunking strategy depending on stream mode . In snapshot mode batched items will not be flushed to the client until the batch is complete or the underlying stream has terminated . In subscribe or snapshot - then - subscribe mode batched items will be flushed whenever the underlying stream is pending ensuring clients always receive latest results .
pub fn new_batcher<I, T, E>(
    items: I,
    stats: Arc<BatchIteratorConnectionStats>,
    mode: StreamMode,
) -> FormattedStream
where
    I: Stream<Item = Result<T, E>> + Send + 'static,
    T: Into<FormattedContent> + Send,
    E: Into<AccessorError> + Send,
{
    match mode {
        StreamMode::Subscribe | StreamMode::SnapshotThenSubscribe => {
            Box::pin(FormattedContentBatcher {
                items: items.ready_chunks(MAXIMUM_ENTRIES_PER_BATCH as _),
                stats,
            })
        }
        StreamMode::Snapshot => Box::pin(FormattedContentBatcher {
            items: items.chunks(MAXIMUM_ENTRIES_PER_BATCH as _),
            stats,
        }),
    }
}
pub fn new_batcher < I , T , E > ( items : I , stats : Arc < BatchIteratorConnectionStats > , mode : StreamMode , ) -> FormattedStream where I : Stream < Item = Result < T , E > > + Send + ' static , T : Into < FormattedContent > + Send , E : Into < AccessorError > + Send , { match mode { StreamMode :: Subscribe | StreamMode :: SnapshotThenSubscribe => { Box :: pin ( FormattedContentBatcher { items : items . ready_chunks ( MAXIMUM_ENTRIES_PER_BATCH as _ ) , stats , } ) } StreamMode :: Snapshot => Box :: pin ( FormattedContentBatcher { items : items . chunks ( MAXIMUM_ENTRIES_PER_BATCH as _ ) , stats , } ) , } }
Make a new `FormattedContentBatcher` with a chunking strategy depending on stream mode.
Make a new ` FormattedContentBatcher ` with a chunking strategy depending on stream mode .
items
I
stats
Arc<BatchIteratorConnectionStats>
mode
StreamMode
items
I
stats
Arc<BatchIteratorConnectionStats>
mode
StreamMode