Type state pattern, allows writing APIs that are validating their correct use at compile-time:
Require a function to be always called
Enforce order of function calls
Forbid a function to be called twice
Mutually exclusive function calls
useful crate: https://crates.io/crates/typed-builder
Source code for this episode (and the others of the series) can be found at https://github.com/bedroombuilds/pyth...