[][src]Derive Macro unprolix::Constructor

    // Attributes available to this derive:

Generate a pub fn new(...) -> Self method

All the attributes will be included as parameters of the new function.


Some attributes who implements Default may not be required as parameter of the constructor.

For that, there is the option to use #[unprolix(default)]


The following code

This example is not tested
struct SomeStruct {
    a: u8,
    b: u8,
    c: u8,

Expands to

This example is not tested
impl SomeStruct {
    pub fn new(a, b) -> Self {
        Self {
            c: Default::default(),