DoLess - Procedural Macro for Struct Mapping 🦀
DoLess is a Rust procedural macro that allows structs to be initialized from a HashMap<String, String>. It automatically maps field values, providing type-safe conversions.
🚀 Features
- 🏢 Auto-implements
From<HashMap<String, String>>for structs. - 🔄 Supports common Rust types (
String,u8,u16,i32,f64,Option, etc.). - ❌ Compile-time errors for unsupported types.
- ✅ Default values for missing fields.
- ⚙ Supports nested struct parsing with
.notation.
📦 Installation
Add DoLess to your Cargo.toml:
[]
= "0.1.0"
👺 Usage
Basic Struct Mapping
use FromHashMap;
use HashMap;
Nested Struct Support
use FromHashMap;
use HashMap;
Expected Output
Car
🚀 Why Use DoLess?
- Simple & Lightweight — No runtime dependencies, just pure Rust.
- Declarative API — Uses procedural macros to generate efficient
From<HashMap<String, String>>implementations. - Type-Safe & Extensible — Ensures correct conversions and supports nesting.
⚙ Roadmap
- Basic primitive types mapping
- Nested struct support
- Custom conversion support
- Error handling improvements
Happy coding! ✨