lightstream 0.5.0

Composable, zero-copy Arrow IPC and native data streaming for Rust with SIMD-aligned I/O, async support, and memory-mapping.
Documentation
// Copyright Peter G. Bower 2025-2026.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! # Asynchronous stdin byte stream
//!
//! Type alias over [`AsyncReadByteStream`](crate::models::streams::async_read::AsyncReadByteStream) for standard input.
//!
//! ## Use cases
//! - Receive Arrow IPC streams from Unix pipes without loading them fully into memory.
//! - Build CLI tools that compose with other Arrow-aware programs.
//! - Feed piped data directly into async Arrow decoding pipelines.

use crate::enums::BufferChunkSize;
use crate::models::streams::async_read::AsyncReadByteStream;

/// A `Stream` that reads from stdin in fixed-size byte chunks.
pub type StdinByteStream = AsyncReadByteStream<tokio::io::Stdin>;

/// Create a stdin byte stream with the given chunk size.
pub fn from_stdin(size: BufferChunkSize) -> StdinByteStream {
    StdinByteStream::new(tokio::io::stdin(), size)
}

/// Create a stdin byte stream with the default chunk size for pipes.
///
/// Uses `BufferChunkSize::Http` (64 KiB) which works well for most
/// pipe-based streaming scenarios.
pub fn from_stdin_default() -> StdinByteStream {
    from_stdin(BufferChunkSize::Http)
}