Skip to main content

Module io

Module io 

Source

Enums§

FileData
Holds file data — either zero-copy mmap or an owned Vec. Dereferences to &[u8] for transparent use.

Functions§

file_size
Get file size without reading it (for byte-count-only optimization).
read_file
Read a file with zero-copy mmap for large files or read() for small files. Opens once with O_NOATIME, uses fstat for metadata to save a syscall.
read_stdin
Read all bytes from stdin into a Vec. Uses a direct read() loop into a pre-allocated buffer instead of read_to_end(), which avoids Vec’s grow-and-probe pattern (extra read() calls and memcpy). On Linux, enlarges the pipe buffer to 4MB first for fewer read() syscalls.