1 unstable release
0.1.0 | Nov 21, 2024 |
---|
#41 in #bool
68 downloads per month
Used in linearize
22KB
474 lines
linearize
This crate provides a trait that defines an enumeration of a type and an efficient no_std map that uses such types as keys.
Example
use linearize::{Linearize, static_map};
#[derive(Linearize)]
enum Keys {
A,
B(bool),
}
fn main() {
let map = static_map! {
Keys::A => "a",
Keys::B(false) => "b",
Keys::B(true) => "c",
};
assert_eq!(map[Keys::A], "a");
assert_eq!(map[Keys::B(true)], "c");
}
License
This project is licensed under either of
- Apache License, Version 2.0
- MIT License
at your option.
Dependencies
~230–680KB
~16K SLoC