pub fn read_audio_file_with_options(
path: impl AsRef<Path>,
options: &ReadAudioOptions,
) -> Result<Audio>Expand description
Read a bounded regular file, then decode the same buffer without copying it.
Follows symlinks to regular files, including outside any project directory;
containment is the caller’s responsibility. Static directories, FIFOs, devices
and other nonregular targets are rejected before opening with
InvalidArgument. The opened handle is checked again. This assumes a stable
filesystem path: portable safe std I/O does not atomically protect the open
against hostile replacement by a FIFO or another target between checks.
Both metadata size and actual bytes are bounded. Reads at most cap+1 bytes
(the extra byte detects growth), stores at most cap, and accepts exact-cap
files. Oversize or failed buffer reservation returns LimitExceeded; I/O
errors return Io. Invalid encoded data/decoded limits retain decoder errors.
There is no unrestricted fs::read or second encoded-buffer allocation.