Skip to content

Comment on Functional State Machines in Rust: Typestate and Newtype Patternsparent

Comments

This is not really ST. This is analogous to eating at an old school restaurant.

You can't just walk in to the food service counter and say "give me a burger"; you need to first get a ticket from the cashier proving that you've ordered a burger and then provide that ticket to the guy at the counter.

That's literally the type state pattern

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.