Skip to main content

tex_engine/
utils.rs

1/*! Utility methods and data structures.*/
2
3use lazy_static::lazy_static;
4use std::path::PathBuf;
5
6pub mod errors;
7
8/// A [`HashMap`](std::collections::HashMap) with [`rustc_hash`] as hasher.
9pub type HMap<A, B> = rustc_hash::FxHashMap<A, B>; //ahash::HashMap<A,B>;
10pub type HSet<A> = rustc_hash::FxHashSet<A>; //ahash::HashSet<A>;
11
12#[cfg(feature = "multithreaded")]
13/// The reference counting pointer type used throughout the engine.
14pub type Ptr<A> = std::sync::Arc<A>;
15#[cfg(not(feature = "multithreaded"))]
16/// The reference counting pointer type used throughout the engine.
17pub type Ptr<A> = std::rc::Rc<A>;
18
19lazy_static! {
20    /// The current working directory.
21    pub static ref PWD : PathBuf = std::env::current_dir().expect("No current directory!");
22}