inquire/
config.rs

1//! Global config definitions.
2
3use std::sync::Mutex;
4
5use once_cell::sync::Lazy;
6
7use crate::ui::RenderConfig;
8
9static GLOBAL_RENDER_CONFIGURATION: Lazy<Mutex<RenderConfig<'static>>> =
10    Lazy::new(|| Mutex::new(RenderConfig::default()));
11
12pub fn get_configuration() -> RenderConfig<'static> {
13    *GLOBAL_RENDER_CONFIGURATION.lock().unwrap()
14}
15
16/// Acquires a write lock to the global RenderConfig object
17/// and updates the inner value with the provided argument.
18pub fn set_global_render_config(config: RenderConfig<'static>) {
19    let mut guard = GLOBAL_RENDER_CONFIGURATION.lock().unwrap();
20    *guard = config;
21}
22
23/// Default page size when displaying options to the user.
24pub const DEFAULT_PAGE_SIZE: usize = 7;
25
26/// Default value of vim mode.
27pub const DEFAULT_VIM_MODE: bool = false;