solar_data_structures/index.rs
1//! Index types. See [`::oxc_index`].
2
3pub use oxc_index::{
4 Idx, IdxRangeBounds, IdxSliceIndex, IndexBox, IndexSlice, IndexVec, index_box, index_vec,
5 nonmax::NonMaxU32,
6};
7
8/// Creates a new index type backed by `NonMaxU32`, with niche optimization for `Option<T>`.
9#[macro_export]
10macro_rules! newtype_index {
11 ($($(#[$attr:meta])* $vis:vis struct $name:ident;)*) => {$(
12 $crate::index::define_nonmax_u32_index_type! {
13 $(#[$attr])*
14 $vis struct $name;
15 }
16
17 impl $name {
18 /// The maximum index value.
19 $vis const MAX: Self = Self::new(Self::MAX_INDEX);
20 }
21 )*};
22}
23
24pub use oxc_index::define_nonmax_u32_index_type;