1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Lazy `Debug`-to-`Display` adaptation for scalar redaction.
use fmt;
/// Presents a borrowed [`fmt::Debug`] value through [`fmt::Display`].
///
/// This adapter performs no eager allocation or formatting. Passing it to
/// [`crate::Redactor::redact_field`] or [`crate::RedactedTextComposer::field`]
/// lets an opaque high- or secret-sensitivity mask avoid observing the wrapped
/// value altogether. The wrapped `Debug` implementation runs only when the
/// selected policy needs the source representation, such as for pass-through,
/// disabled, low-, or medium-sensitivity rendering.
///
/// # Examples
///
/// ```
/// use qubit_redact::{DebugDisplay, Redactor};
///
/// let values = vec!["first", "second"];
/// let output = Redactor::strict().redact_field("selection", &DebugDisplay::new(&values));
/// assert_eq!(output.text().as_str(), "<redacted>");
/// ```