Skip to main content

qubit_lock/double_checked/
executor_config.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2025 - 2026.
4 *    Haixing Hu, Qubit Co. Ltd.
5 *
6 *    All rights reserved.
7 *
8 ******************************************************************************/
9//! # Executor Configuration
10//!
11//! Provides executor configuration for the double-checked lock executor.
12//!
13//! # Author
14//!
15//! Haixing Hu
16
17/// Executor configuration
18///
19/// Configures various execution options for the double-checked lock
20/// executor, including performance metrics and error handling.
21///
22/// # Examples
23///
24/// ```rust
25/// use qubit_lock::double_checked::ExecutorConfig;
26///
27/// let config = ExecutorConfig::default();
28/// assert!(!config.enable_metrics);
29/// assert!(!config.disable_backtrace);
30/// ```
31///
32/// # Author
33///
34/// Haixing Hu
35///
36#[derive(Debug, Clone)]
37pub struct ExecutorConfig {
38    /// Whether to enable performance metrics collection
39    pub enable_metrics: bool,
40
41    /// Whether to disable error backtrace for performance
42    pub disable_backtrace: bool,
43}
44
45impl Default for ExecutorConfig {
46    /// Creates a default executor configuration
47    ///
48    /// # Returns
49    ///
50    /// A default configuration with metrics disabled and backtrace enabled.
51    #[inline]
52    fn default() -> Self {
53        Self {
54            enable_metrics: false,
55            disable_backtrace: false,
56        }
57    }
58}