type-state-builder 0.5.1

Type-state builder pattern derive macro with compile-time safety and enhanced ergonomics.
Documentation
// Test raw identifiers with keywords

use type_state_builder::TypeStateBuilder;

#[derive(TypeStateBuilder)]
struct TestWithKeywords {
    #[builder(required)]
    r#type: String, // 'type' is a keyword

    r#async: Option<bool>, // 'async' is a keyword
}

#[test]
fn test_raw_identifiers() {
    let instance = TestWithKeywords::builder()
        .r#type("test".to_string())
        .r#async(Some(true))
        .build();

    assert_eq!(instance.r#type, "test");
    assert_eq!(instance.r#async, Some(true));
}