Skip to main content

qubit_value/multi_values/
multi_values_ref.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//! Borrowed semantic views for [`crate::MultiValues`].
10
11use qubit_datatype::DataType;
12
13/// Borrowed semantic view of a [`crate::MultiValues`] value.
14#[must_use]
15#[non_exhaustive]
16#[derive(Debug, Clone, Copy)]
17pub enum MultiValuesRef<'a> {
18    /// An unset collection retaining its declared element type.
19    Unset(DataType),
20    /// A borrowed homogeneous collection.
21    Bool(&'a [bool]),
22    /// A borrowed homogeneous collection.
23    Char(&'a [char]),
24    /// A borrowed homogeneous collection.
25    Int8(&'a [i8]),
26    /// A borrowed homogeneous collection.
27    Int16(&'a [i16]),
28    /// A borrowed homogeneous collection.
29    Int32(&'a [i32]),
30    /// A borrowed homogeneous collection.
31    Int64(&'a [i64]),
32    /// A borrowed homogeneous collection.
33    Int128(&'a [i128]),
34    /// A borrowed homogeneous collection.
35    UInt8(&'a [u8]),
36    /// A borrowed homogeneous collection.
37    UInt16(&'a [u16]),
38    /// A borrowed homogeneous collection.
39    UInt32(&'a [u32]),
40    /// A borrowed homogeneous collection.
41    UInt64(&'a [u64]),
42    /// A borrowed homogeneous collection.
43    UInt128(&'a [u128]),
44    /// A borrowed homogeneous collection.
45    Float32(&'a [f32]),
46    /// A borrowed homogeneous collection.
47    Float64(&'a [f64]),
48    /// A borrowed homogeneous collection.
49    #[cfg(feature = "big-integer")]
50    BigInteger(&'a [num_bigint::BigInt]),
51    /// A borrowed homogeneous collection.
52    #[cfg(feature = "big-decimal")]
53    BigDecimal(&'a [bigdecimal::BigDecimal]),
54    /// A borrowed homogeneous collection.
55    String(&'a [String]),
56    /// A borrowed homogeneous collection.
57    #[cfg(feature = "chrono")]
58    Date(&'a [chrono::NaiveDate]),
59    /// A borrowed homogeneous collection.
60    #[cfg(feature = "chrono")]
61    Time(&'a [chrono::NaiveTime]),
62    /// A borrowed homogeneous collection.
63    #[cfg(feature = "chrono")]
64    DateTime(&'a [chrono::NaiveDateTime]),
65    /// A borrowed homogeneous collection.
66    #[cfg(feature = "chrono")]
67    Instant(&'a [chrono::DateTime<chrono::Utc>]),
68    /// A borrowed homogeneous collection.
69    Duration(&'a [std::time::Duration]),
70    /// A borrowed homogeneous collection.
71    #[cfg(feature = "url")]
72    Url(&'a [url::Url]),
73    /// A borrowed homogeneous collection.
74    StringMap(&'a [std::collections::HashMap<String, String>]),
75    /// A borrowed homogeneous collection.
76    #[cfg(feature = "json")]
77    Json(&'a [serde_json::Value]),
78}