Crates.io | linearize |
lib.rs | linearize |
version | |
source | src |
created_at | 2024-11-21 11:13:09.655508 |
updated_at | 2024-11-21 12:16:33.34406 |
description | Types that are enumerable and an array-backed map |
homepage | |
repository | https://github.com/mahkoh/linearize |
max_upload_size | |
id | 1456039 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This crate provides a trait that defines an enumeration of a type and an efficient no_std map that uses such types as keys.
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");
}
This project is licensed under either of
at your option.