Skip to main content

Options

Struct Options 

Source
pub struct Options {
    pub progname: String,
    pub engine: String,
    pub selfautoloc: Option<PathBuf>,
    pub cache_dir: Option<PathBuf>,
}
Expand description

Configuration for constructing a Kpathsea instance.

Fields§

§progname: String

The program name ($progname), e.g. lualatex.

§engine: String

The 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.

Implementations§

Source§

impl Options

Source

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
Hide additional 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§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, !>

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.