You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Behind the scene, `finalize_with_default` works by using the `UpdateField` trait to perform a *natural transformation* on each field modifier. It applies the `Default` implementation to convert `IsNothing` fields into `IsPresent`, completing the record automatically.
@@ -193,11 +193,11 @@ To address this limitation, a new `IsOptional` field state has been introduced.
193
193
You can create and use an optional builder with the `optional_builder`, `set`, and `finalize_optional` methods as shown below:
Unlike the original typestate builder, the type of the builder remains `__PartialFooBar<IsOptional, IsOptional>` after each call to `set`. The `finalize_optional` method returns a `Result`, producing an error if any field contains a `None` value. This check is necessary because, without the typestate guarantees, the compiler cannot ensure at compile time that all fields are initialized.
0 commit comments