new_derivable 0.2.0

Create new implementations with just a paste of a macro
Documentation

New Derivable

Automatically create a new implementation for your Structs (Unnamed, and Named).

use new_derivable::New;

#[derive(New,Debug)]
pub struct Human {
	pub name: String,
	pub age: i64
}

will ceate

impl Human {
	fn new(name: String, age: i64) -> Self {
		Self { name, age }
	}
}

so then you can do

fn main() {
	let human = Human::new(String::from("Justin"),69);
	println!("{:#?}", human);
}

Which will give us

Human {
	name: "Justin",
	age: 69
}