Skip to main content

tess/
lib.rs

1#![allow(rustdoc::broken_intra_doc_links)]
2#![doc = include_str!("../README.md")]
3
4pub mod ansi;
5pub mod error;
6pub mod render;
7pub mod source;
8pub mod line_index;
9pub mod marks;
10pub mod viewport;
11pub mod input;
12pub mod terminal;
13pub mod app;
14pub mod cli;
15pub mod format;
16pub mod file_set;
17pub mod filter;
18pub mod prompt;
19pub mod grep;
20pub mod hex;
21pub mod prettify;
22pub mod batch;
23pub mod clipboard;
24pub mod shell;
25pub mod preprocess;
26pub mod keys;
27pub mod style_spec;
28pub mod open;
29pub mod or;
30pub mod overlay;
31pub mod pane;
32pub mod tags;
33pub mod keymap;
34pub mod config_path;
35#[cfg(feature = "image")]
36pub mod anim;
37#[cfg(feature = "image")]
38pub mod image_render;
39#[cfg(feature = "image")]
40pub mod image_export;
41#[cfg(feature = "image")]
42pub mod image_protocol;
43#[cfg(feature = "image")]
44pub mod term_query;
45
46#[cfg(test)]
47pub(crate) mod test_env {
48    use std::sync::{Mutex, MutexGuard};
49
50    /// Process-wide lock serializing every test that mutates the global
51    /// `HOME` / `TESS_GLOBAL_CONFIG_DIR` env vars. Those vars are process
52    /// global, so a per-module lock can't stop tests in *different* modules
53    /// (format, keys, config_path, app) from trampling each other under
54    /// cargo's parallel runner. One shared lock is the only thing that
55    /// actually serializes them.
56    static ENV_LOCK: Mutex<()> = Mutex::new(());
57
58    /// Poison-tolerant acquire: a test that panics while holding the lock
59    /// must not cascade `PoisonError` into every other env-mutating test.
60    pub(crate) fn lock() -> MutexGuard<'static, ()> {
61        ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner())
62    }
63}