Derive Macro roopes::prelude::Builder

source ·
#[derive(Builder)]
Expand description

Creates a new type on the specified struct, which allows fields to be set one at a time. The new builder type’s name is the specified type, appended with “Builder”.

Examples

#[macro_use]
use roopes::prelude::*;

#[derive(Builder)]
struct TestObj
{
    field: i32,
}

let builder = TestObjBuilder::new().set_field(10);

let test_obj = builder.build();

assert_eq!(test_obj.field, 10);