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
//!
//! # Usage
//!
//!```rust
//!
//! use st_map::StaticMap;
//!
//! #[derive(Debug, PartialEq, Default, StaticMap)]
//! struct BrowserData<T: Default> {
//! chrome: T,
//! safari: T,
//! android: T,
//! }
//!
//! {
//! // .iter(), .iter_mut(), .into_iter()
//! let mut data = BrowserData {
//! chrome: true,
//! safari: false,
//! android: true,
//! };
//! assert_eq!(
//! data.iter().collect::<Vec<_>>(),
//! vec![("chrome", &true), ("safari", &false), ("android", &true),]
//! );
//!
//! assert_eq!(
//! data.iter_mut().collect::<Vec<_>>(),
//! vec![
//! ("chrome", &mut true),
//! ("safari", &mut false),
//! ("android", &mut true),
//! ]
//! );
//!
//! assert_eq!(
//! data.into_iter().collect::<Vec<_>>(),
//! vec![("chrome", true), ("safari", false), ("android", true),]
//! );
//! }
//!
//! {
//! // .map(), .map_values()
//!
//! let data = BrowserData {
//! chrome: 20000,
//! safari: 10000,
//! ..Default::default()
//! };
//!
//! assert_eq!(
//! data.map_value(|v| v > 15000),
//! BrowserData {
//! chrome: true,
//! safari: false,
//! android: false,
//! }
//! );
//! }
//! ```
pub use arrayvec;
pub use static_map_macro::StaticMap;