Skip to main content

qubit_validator/report/
violation_param.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
9//! Restricted vocabulary for structured validation diagnostic parameters.
10
11/// A restricted vocabulary for diagnostic parameters. The type limits how a
12/// value is represented; it cannot prove where the value came from. Callers
13/// must supply only program-declared tokens or rule configuration values, never
14/// rejected input or sensitive values derived from it.
15///
16/// # Examples
17///
18/// ```
19/// use qubit_validator::ViolationParam;
20///
21/// let parameter = ViolationParam::Unsigned(3);
22/// assert_eq!(parameter, ViolationParam::Unsigned(3));
23/// ```
24#[derive(Clone, Copy, Debug, Eq, PartialEq)]
25#[non_exhaustive]
26pub enum ViolationParam {
27    /// A boolean parameter.
28    Bool(
29        /// Safe Boolean metadata.
30        bool,
31    ),
32    /// A signed integer parameter.
33    Signed(
34        /// Safe signed integer metadata.
35        i128,
36    ),
37    /// An unsigned integer parameter.
38    Unsigned(
39        /// Safe unsigned integer metadata.
40        u128,
41    ),
42    /// A token with a static lifetime; the lifetime does not prove its source.
43    Token(
44        /// Callers must provide a program-declared token, not rejected input.
45        &'static str,
46    ),
47}