computed_map
A Rust proc-macro crate for generating indexed maps with computed fields and indices.
Features
- Procedural macro to generate map types with computed indices.
- Supports multiple computed indices per map.
- Automatically maintains indices as values are inserted or removed.
Example
use *;
generate_table!
Usage
Add to your Cargo.toml:
[]
= "0.1.0"
Then use the generate_table! macro to define your indexed map.
Macro Syntax
generate_table!
TableName: Name of the generated table struct.KeyType: Type of the key.ValueType: Type of the value.ComputedName: Name of the computed value.ComputedFunction: Function to compute a value dependant on the original type. Must be a typed closureAddIndex: Whether to add an index over the computed field (trueorfalse).
You can specify multiple indices by repeating the triple: ComputedName, ComputedFunction, AddIndex.
License
Licensed under MIT.