Skip to main content

qubit_argument/argument/constraint/
comparison_constraint.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//! Scalar comparison constraints.
9
10use crate::argument::ArgumentValue;
11
12/// A comparison between an argument and a captured scalar value.
13///
14/// ```compile_fail
15/// #![deny(unused_must_use)]
16/// use qubit_argument::{ArgumentValue, ComparisonConstraint};
17///
18/// ComparisonConstraint::EqualTo(ArgumentValue::Signed(1));
19/// ```
20#[must_use]
21#[derive(Debug, Clone, PartialEq, Eq)]
22pub enum ComparisonConstraint {
23    /// Requires equality with the captured value.
24    EqualTo(ArgumentValue),
25    /// Requires inequality with the captured value.
26    NotEqualTo(ArgumentValue),
27    /// Requires a value strictly less than the captured value.
28    LessThan(ArgumentValue),
29    /// Requires a value less than or equal to the captured value.
30    AtMost(ArgumentValue),
31    /// Requires a value strictly greater than the captured value.
32    GreaterThan(ArgumentValue),
33    /// Requires a value greater than or equal to the captured value.
34    AtLeast(ArgumentValue),
35}