pub enum FileHandle {
Real(BufReader<File>),
Stdin,
Stdout,
Stderr,
Closed,
Filter(Box<FilterState>),
StringSource {
data: Vec<u8>,
pos: usize,
},
PendingProc {
proc: PsObject,
},
}Expand description
The underlying handle for a file.
Variants§
Real(BufReader<File>)
Real file on disk (buffered for efficient byte-at-a-time reads).
Stdin
Standard input (uses stdin).
Stdout
Standard output (uses stdout).
Stderr
Standard error (uses stderr).
Closed
File has been closed.
Filter(Box<FilterState>)
Decode/encode filter wrapping another file.
StringSource
In-memory byte source (for string-backed data).
PendingProc
A procedure data source that has not been run yet (PLRM 3.8.4).
This is a transitional state. The procedure has to be executed by the
interpreter, which FileStore cannot reach, so the read path leaves it
alone and Context::pump_proc_sources replaces the whole handle with a
StringSource before any read reaches it. Every other part of the store
therefore only ever sees StringSource.
Reading one directly is a bug — a consumer that failed to pump first — and falls through to the “not readable” arm rather than quietly reporting end-of-file, so the mistake is visible instead of silently truncating the stream to nothing.