diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-08-20 12:56:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-20 10:56:54 +0000 |
| commit | 986d624b3a19df757b1ad05576cc0fb1d78dc2d4 (patch) | |
| tree | 06b2e8e665e93d92fe03bbc9c992362155affb01 /crates/typst-cli | |
| parent | a30b681251ef684b4bcfdc43787ad058b5e600f6 (diff) | |
Share allocations for singletons (#4794)
Diffstat (limited to 'crates/typst-cli')
| -rw-r--r-- | crates/typst-cli/src/terminal.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/typst-cli/src/terminal.rs b/crates/typst-cli/src/terminal.rs index cf2906eb..45b8c82b 100644 --- a/crates/typst-cli/src/terminal.rs +++ b/crates/typst-cli/src/terminal.rs @@ -1,15 +1,16 @@ use std::io::{self, IsTerminal, Write}; use codespan_reporting::term::termcolor; -use once_cell::sync::Lazy; use termcolor::{ColorChoice, WriteColor}; +use typst::utils::singleton; use crate::ARGS; /// Returns a handle to the optionally colored terminal output. pub fn out() -> TermOut { - static OUTPUT: Lazy<TermOutInner> = Lazy::new(TermOutInner::new); - TermOut { inner: &OUTPUT } + TermOut { + inner: singleton!(TermOutInner, TermOutInner::new()), + } } /// The stuff that has to be shared between instances of [`TermOut`]. |
