#builder-pattern #pattern #builder #type-state #state #derive #macro-derive

macro typestate-builder-macro

Derive-macro-based generator that combines Typestate and Builder patterns

4 releases

0.1.4 Oct 30, 2024
0.1.3 Oct 30, 2024
0.1.2 Oct 30, 2024
0.1.1 Sep 25, 2024

#4 in #typestate


Used in typestate-builder

MIT/Apache

110KB
2.5K SLoC

typestate-builder

TypestateBuilder is a Rust procedural macro that enables the creation of builder patterns using the typestate design pattern. This macro ensures that your structs are built in a way that enforces compile-time safety, ensuring that required fields are initialized before the struct is created.

For more informatiion, read the document.

License

TypestateBuilder is dual-licensed under the MIT and Apache 2.0 licenses. See the LICENSE-MIT and LICENSE-APACHE files for details.


lib.rs:

This crate provides the TypestateBuilder derive macro for generating a typestate-pattern builder for structs.

This is the helper crate of typestate-builder.

Dependencies

~2.9–4MB
~70K SLoC