Trait tectonic_io_base::IoProvider[][src]

pub trait IoProvider: AsIoProviderMut {
    fn output_open_name(&mut self, _name: &str) -> OpenResult<OutputHandle> { ... }
fn output_open_stdout(&mut self) -> OpenResult<OutputHandle> { ... }
fn input_open_name(
        &mut self,
        _name: &str,
        _status: &mut dyn StatusBackend
    ) -> OpenResult<InputHandle> { ... }
fn input_open_name_with_abspath(
        &mut self,
        name: &str,
        status: &mut dyn StatusBackend
    ) -> OpenResult<(InputHandle, Option<PathBuf>)> { ... }
fn input_open_primary(
        &mut self,
        _status: &mut dyn StatusBackend
    ) -> OpenResult<InputHandle> { ... }
fn input_open_primary_with_abspath(
        &mut self,
        status: &mut dyn StatusBackend
    ) -> OpenResult<(InputHandle, Option<PathBuf>)> { ... }
fn input_open_format(
        &mut self,
        name: &str,
        status: &mut dyn StatusBackend
    ) -> OpenResult<InputHandle> { ... }
fn write_format(
        &mut self,
        _name: &str,
        _data: &[u8],
        _status: &mut dyn StatusBackend
    ) -> Result<()> { ... } }
Expand description

A trait for types that can read or write files needed by the TeX engine.

An IO provider is a source of handles. One wrinkle is that it’s good to be able to distinguish between unavailability of a given name and error accessing it.

Provided methods

Open the named file for output.

Open the standard output stream.

Open the named file for input.

Open the named file for input and return filesystem path information.

This method extends Self::input_open_name to help support SyncTeX output. While SyncTeX output files should contain absolute source file paths, Tectonic’s pluggable I/O system makes it so that the mapping between input names and filesystem paths is not well-defined. This optional interface enables backends to provide filesystem information at the time of opening.

The default implementation returns None for the path information, to preserve backwards compatibility. If you are implementing a new backend that might provide path information, or you are implementing an I/O provider that delegates to other I/O providers, you should implement this function fully, and then provide a simple implementation of Self::input_open_name that drops the pathing information.

Open the “primary” input file, which in the context of TeX is the main input that it’s given. When the build is being done using the filesystem and the input is a file on the filesystem, this function isn’t necesssarily that important, but those conditions don’t always hold.

Open the primary input and return filesystem path information.

This method is as to Self::input_open_primary as Self::input_open_name_with_abspath is to Self::input_open_name.

Open a format file with the specified name. Format files have a specialized entry point because IOProviders may wish to handle them specially: namely, to munge the filename to one that includes the current version of the Tectonic engine, since the format contents depend sensitively on the engine internals.

Save an a format dump in some way that this provider may be able to recover in the future. This awkward interface is needed for to write formats with their special munged file names.

Implementations on Foreign Types

Implementors