1use tectonic_status_base::StatusBackend;
7
8pub mod format_cache;
9pub mod memory;
10
11pub use tectonic_io_base::{
14 digest::{self, DigestData},
15 filesystem::{FilesystemIo, FilesystemPrimaryInputIo},
16 normalize_tex_path,
17 stack::IoStack,
18 stdstreams::GenuineStdoutIo,
19 try_open_file, InputFeatures, InputHandle, InputOrigin, IoProvider, OpenResult, OutputHandle,
20};
21
22pub use self::memory::MemoryIo;
25
26#[doc(hidden)]
30pub mod testing {
31 use super::*;
32 use std::fs::File;
33 use std::path::{Path, PathBuf};
34
35 pub struct SingleInputFileIo {
36 name: String,
37 full_path: PathBuf,
38 }
39
40 impl SingleInputFileIo {
41 pub fn new(path: &Path) -> SingleInputFileIo {
42 let p = path.to_path_buf();
43
44 SingleInputFileIo {
45 name: p.file_name().unwrap().to_str().unwrap().to_owned(),
46 full_path: p,
47 }
48 }
49 }
50
51 impl IoProvider for SingleInputFileIo {
52 fn output_open_name(&mut self, _: &str) -> OpenResult<OutputHandle> {
53 OpenResult::NotAvailable
54 }
55
56 fn output_open_stdout(&mut self) -> OpenResult<OutputHandle> {
57 OpenResult::NotAvailable
58 }
59
60 fn input_open_name(
61 &mut self,
62 name: &str,
63 _status: &mut dyn StatusBackend,
64 ) -> OpenResult<InputHandle> {
65 if name == self.name {
66 OpenResult::Ok(InputHandle::new(
67 name,
68 File::open(&self.full_path).unwrap(),
69 InputOrigin::Filesystem,
70 ))
71 } else {
72 OpenResult::NotAvailable
73 }
74 }
75 }
76}