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#[must_use]
16#[non_exhaustive]
17#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
18pub enum UnkeyedJsonValuePolicy {
19    /// Replaces unkeyed scalar values with the Secret opaque mask.
20    #[default]
21    Redact,
22    /// Preserves unkeyed scalar values for diagnostics.
23    PassThrough,
24}