exhaustive_map/lib.rs
1#![doc = include_str!("../README.md")]
2//! ## Features
3//!
4//! - `serde` - Enables serialization and deserialization of [`ExhaustiveMap`].
5//! Example:
6//! ```
7//! # #[cfg(feature = "serde")]
8//! # {
9//! use exhaustive_map::{ExhaustiveMap, Finite};
10//! use serde::Serialize;
11//!
12//! #[derive(Finite, Serialize)]
13//! enum Color {
14//! Red,
15//! Green,
16//! Blue,
17//! }
18//!
19//! let map = ExhaustiveMap::<Color, _>::from_usize_fn(|i| i);
20//! let json = serde_json::to_string(&map).unwrap();
21//! assert_eq!(json, r#"{"Red":0,"Green":1,"Blue":2}"#);
22//! # }
23//! ```
24#![no_std]
25#![warn(clippy::pedantic)]
26#![deny(clippy::undocumented_unsafe_blocks)]
27
28#[cfg(feature = "alloc")]
29extern crate alloc;
30
31#[cfg(feature = "std")]
32extern crate std;
33
34mod finite;
35mod finite_impls;
36mod map;
37mod range;
38
39pub use finite::{Finite, FiniteExt, FitsInUsize, IterAll};
40pub use generic_array::{self, typenum};
41pub use map::{ExhaustiveMap, IntoIter, IntoValues, Iter, IterMut, Values, ValuesMut};
42pub use range::{InRange, InRangeBounds, InRangeInclusive};
43
44extern crate self as exhaustive_map;