[![Build Status](https://travis-ci.org/Ivan1931/smelter.svg?branch=master)](https://travis-ci.org/Ivan1931/smelter) [![Latest Version](https://img.shields.io/crates/v/smelter.svg)](https://crates.io/crates/smelter) # About Smelter is an extremely lightweight rust proc_macro library to derive "Builder" methods for arbitrary rust structs. # Usage ## Setup ```toml [dependencies] smelter = "*" ``` Add the following to the file in which you with to use smelter. ``` #![feature(proc_macro, custom_attribute)] #[macro_use] extern crate smelter; ``` Then just add ```#[derive(Builder)]``` above your struct, ## Example
Smelter | Generated Code |
#![feature(proc_macro, custom_attribute)]
#[macro_use]
extern crate smelter;
#[derive(PartialEq, Builder, Default, Debug, Clone)]
#[smelter(prefix="with_")]
pub struct User {
pub uid: u64,
pub email: String,
pub alias: String,
pub friends: Vec
|
# [ allow ( dead_code ) ]
impl User {
pub fn with_uid(self, __value: u64) -> User {
User { uid: __value, ..self }
}
pub fn with_email(self, __value: String) -> User {
User { email: __value, ..self }
}
pub fn with_alias(self, __value: String) -> User {
User { alias: __value, ..self }
}
pub fn with_friends(self, __value: Vec
|