Skip to main content

FileHandle

Enum FileHandle 

Source
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).

Fields

§data: Vec<u8>
§pos: usize
§

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.

Fields

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.