Skip to main content

qubit_redact/policy/
unkeyed_json_value_policy.rs

1// =============================================================================
2//    Copyright (c) 2026 Haixing Hu.
3//
4//    SPDX-License-Identifier: Apache-2.0
5//
6//    Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Policy for JSON scalar values without an object-field context.
9
10/// Controls whether unkeyed JSON scalar values are redacted or preserved.
11///
12/// Unkeyed scalars are root scalar values and scalar elements of arrays.
13/// Object property values remain keyed even when their field rule passes
14/// through.
15///
16/// # Examples
17///
18/// ```
19/// use qubit_redact::UnkeyedJsonValuePolicy;
20///
21/// assert_eq!(UnkeyedJsonValuePolicy::default(), UnkeyedJsonValuePolicy::Redact);
22/// ```
23#[non_exhaustive]
24#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
25pub enum UnkeyedJsonValuePolicy {
26    /// Replaces unkeyed scalar values with the Secret opaque mask.
27    #[default]
28    Redact,
29    /// Preserves unkeyed scalar values for diagnostics.
30    PassThrough,
31}