Skip to main content

qubit_redact/policy/
global_default_already_set.rs

1// =============================================================================
2//    Copyright (c) 2025 - 2026 Haixing Hu.
3//
4//    SPDX-License-Identifier: Apache-2.0
5//
6//    Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Error reported when the process-wide default policy is already installed.
9
10use std::{
11    error::Error,
12    fmt,
13};
14
15/// Error returned when a process-wide default policy was already installed.
16#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
17pub struct GlobalDefaultAlreadySet;
18
19impl fmt::Display for GlobalDefaultAlreadySet {
20    /// Formats a concise description of the one-time installation failure.
21    ///
22    /// # Parameters
23    ///
24    /// * `formatter` - Destination formatting context.
25    ///
26    /// # Returns
27    ///
28    /// The formatter result from writing the error description.
29    ///
30    /// # Errors
31    ///
32    /// Returns [`fmt::Error`] when the destination rejects a write.
33    #[inline(always)]
34    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
35        formatter
36            .write_str("the global default redaction policy is already set")
37    }
38}
39
40impl Error for GlobalDefaultAlreadySet {}