pub struct Options {
pub progname: String,
pub engine: String,
pub selfautoloc: Option<PathBuf>,
pub cache_dir: Option<PathBuf>,
pub cnf_lines: Vec<String>,
}Expand description
Configuration for constructing a Kpathsea instance.
Fields§
§progname: StringThe program name ($progname), e.g. lualatex.
engine: StringThe engine name ($engine), e.g. luahbtex.
selfautoloc: Option<PathBuf>The directory standing in for $SELFAUTOLOC (the directory containing
the TeX binaries). None locates kpsewhich on PATH.
cache_dir: Option<PathBuf>A directory where parsed ls-R databases are cached between runs.
cnf_lines: Vec<String>Configuration lines given on the command line (-cnf-line); they
take precedence over the texmf.cnf files.
Implementations§
Source§impl Options
impl Options
Sourcepub fn lualatex() -> Self
pub fn lualatex() -> Self
Options for the lualatex program run by the luahbtex engine.
Examples found in repository?
examples/kpsewhich.rs (line 13)
4fn main() {
5 let args: Vec<String> = std::env::args().collect();
6 let fmt = match args.get(1).map(String::as_str) {
7 Some("lua") => FileFormat::Lua,
8 Some("fmt") => FileFormat::Fmt,
9 Some("otf") => FileFormat::OpenType,
10 Some("tfm") => FileFormat::Tfm,
11 _ => FileFormat::Tex,
12 };
13 let mut k = Kpathsea::new(Options::lualatex()).unwrap();
14 let t = std::time::Instant::now();
15 let found = k.find_file(&args[2], fmt);
16 eprintln!("path: {:?}", k.search_path(fmt));
17 println!("{found:?} ({:?})", t.elapsed());
18}More examples
examples/kpsetime.rs (line 6)
4fn main() {
5 let t = std::time::Instant::now();
6 let mut o = Options::lualatex();
7 o.cache_dir = Some(std::env::temp_dir().join("retex-kpse-test"));
8 let mut k = Kpathsea::new(o).unwrap();
9 let init = t.elapsed();
10 let t = std::time::Instant::now();
11 for n in [
12 "latex.ltx",
13 "article.cls",
14 "size10.clo",
15 "lmroman10-regular.otf",
16 "ltluatex.lua",
17 ] {
18 let f = if n.ends_with(".otf") {
19 FileFormat::OpenType
20 } else if n.ends_with(".lua") {
21 FileFormat::Lua
22 } else {
23 FileFormat::Tex
24 };
25 let _ = k.find_file(n, f);
26 }
27 println!("init {init:?}, 5 lookups {:?}", t.elapsed());
28}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnsafeUnpin for Options
impl UnwindSafe for Options
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more