1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! # Macros for [`AtomicFixedVec`]
/// Creates an [`AtomicFixedVec`] with default parameters.
///
/// This macro simplifies the creation of an [`AtomicFixedVec`]. It uses a [`u64`]
/// storage backend and [`BitWidth::Minimal`](crate::fixed::BitWidth::Minimal) for space efficiency.
///
/// There are two forms of this macro:
///
/// - Create a vector from a list of elements:
/// ```
/// # use compressed_intvec::atomic_fixed_vec;
/// let vec = atomic_fixed_vec![10u32, 20, 30];
/// # assert_eq!(vec.len(), 3);
/// ```
///
/// - Create a vector from a repeated element:
/// ```
/// # use compressed_intvec::atomic_fixed_vec;
/// let vec = atomic_fixed_vec![0i16; 100];
/// # assert_eq!(vec.len(), 100);
/// ```
///
/// # Examples
///
/// ```
/// use compressed_intvec::prelude::*;
/// use compressed_intvec::atomic_fixed_vec;
/// use compressed_intvec::fixed::UAtomicFixedVec;
///
/// // Create a vector from a list of elements. The type is inferred.
/// let vec = atomic_fixed_vec![10u32, 20, 30];
/// assert_eq!(vec.len(), 3);
/// assert_eq!(vec.bit_width(), 5); // 30 requires 5 bits
///
/// // Create a vector from a repeated element.
/// let vec_rep = atomic_fixed_vec![0i16; 100];
/// assert_eq!(vec_rep.len(), 100);
/// assert_eq!(vec_rep.get(50), Some(0));
///
/// // Create an empty vector (type annotation is required).
/// let empty: UAtomicFixedVec<u64> = atomic_fixed_vec![];
/// assert!(empty.is_empty());
/// ```
// --- Macro Helper Functions (Not part of the public API) ---
use crate;
use crateStorable;
use ToPrimitive;
/// A hidden helper function for the `atomic_fixed_vec![...]` macro variant.
///
/// This function is not intended for direct use. It is called by the macro
/// to construct an `AtomicFixedVec` from a slice of elements.
/// A hidden helper function for the `atomic_fixed_vec![elem; len]` macro variant.
///
/// This function is not intended for direct use. It is called by the macro
/// to construct an `AtomicFixedVec` by repeating an element.