enum_vec/lib.rs
1#![deny(missing_docs)]
2
3//! A vector which efficiently stores enum variants.
4
5extern crate enum_like;
6#[cfg(feature = "smallvec")]
7extern crate smallvec;
8
9/// Not sure if this is needed
10pub use enum_like::*;
11
12// Idea for SmallEnumVec: literally copy paste the code
13// s/Vec/SmallVec
14// Or maybe
15// storage: union { Vec<u32>, [usize; 3] }
16// Tag: MSB of num_elements
17
18#[macro_export]
19macro_rules! enum_vec {
20 ($elem:expr; $n:expr) => ({
21 EnumVec::from_elem($elem, $n)
22 });
23 ($($x:expr),*$(,)*) => ({
24 EnumVec::from_slice(&[$($x),*])
25 });
26}
27
28/// Alternative implementation of `EnumVec` with `Vec<u8>` storage.
29pub mod vec_u8;
30/// Alternative implementation of `EnumVec` with `Vec<u16>` storage.
31pub mod vec_u16;
32/// Default `EnumVec` with `Vec<u32>` storage.
33pub mod vec_u32;
34pub use vec_u32::EnumVec;
35/// Alternative implementation of `EnumVec` with `Vec<u64>` storage.
36pub mod vec_u64;
37/// Alternative implementation of `EnumVec` with `Vec<u128>` storage.
38pub mod vec_u128;
39
40#[cfg(feature = "smallvec")]
41/// `SmallEnumVec`
42pub mod smallvec_u32;