1 unstable release
new 0.1.0 | Nov 21, 2024 |
---|
#982 in Procedural macros
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
~215–650KB
~15K SLoC