# make_fields Tiny derive macro inspired by `makeFields` from the [lens](https://hackage.haskell.org/package/lens-5.2.2) library. Rust's lack of higher kinded types prevents us from doing cool things like monadic tagless final, free monads or monad transformers. I have found that using traits or typeclasses to describe generically what your functions need is sometimes enough in the abscence of these commodities. Thus, this crate. ## Example ```rust use make_fields::HasFields; // This will create immutable accessors for all fields, plus a trait // indicating that some T "Has" that field. #[derive(HasFields)] struct AppConfig { db: HashMap, port: u16, host: String, } // Now we can write our function generically like this, which makes it // easier to write test using a mock object or something. fn connect_to_server(cfg: &T) where T: HasPort + HasHost, { // ... } ``` ## Contributing Please feel free to open an issue or PR if you think you can make `make_fields` better! ## License MIT