Posts tagged: Typestate Pattern

construction orange

The Typestate Pattern: Moving Checks into the Compiler

Learn how to use the typestate pattern in Rust to make missing required fields a compile error instead of a runtime one. Building on the builder pattern, this post shows how to encode construction state in the type system so invalid records cannot be built at all.

Read More