qubit_argument/argument/constraint/index_role.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//! Index roles used by indexed argument validation.
9
10/// The role of an index in an indexed argument operation.
11///
12/// # Examples
13///
14/// ```
15/// use qubit_argument::IndexRole;
16///
17/// let role = IndexRole::Position;
18/// assert!(matches!(role, IndexRole::Position));
19/// ```
20///
21/// ```compile_fail
22/// #![deny(unused_must_use)]
23/// use qubit_argument::IndexRole;
24///
25/// IndexRole::Element;
26/// ```
27#[must_use]
28#[derive(Debug, Clone, Copy, PartialEq, Eq)]
29pub enum IndexRole {
30 /// Identifies an existing element and therefore excludes the collection
31 /// end.
32 Element,
33 /// Identifies an insertion or boundary position, including the collection
34 /// end.
35 Position,
36}