type-state-builder 0.5.1

Type-state builder pattern derive macro with compile-time safety and enhanced ergonomics.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Debug test to see what field names we get

use type_state_builder::TypeStateBuilder;

#[test]
fn test_normal_field_name() {
    #[derive(TypeStateBuilder)]
    struct NormalStruct {
        #[builder(required)]
        normal_field: String,
    }

    let instance = NormalStruct::builder()
        .normal_field("test".to_string())
        .build();

    assert_eq!(instance.normal_field, "test");
}