Typed Builder

🤔 Refer to Builder with typestate in Rust

Do

use typed_builder::TypedBuilder; #[derive(Debug, TypedBuilder)] struct User { id: String, email: String, #[builder(default)] first_name: Option<String>, #[builder(default)] last_name: Option<String>, } fn main() { let katopz = User::builder() .id("13".into()) .email("katopz@gmail.com".into()) .first_name(Some("Kat".into())) .build(); println!("{katopz:?}"); }

▢ CodeSandbox