When to (not) use typestate
Speaker: Matthias Farnbauer-Schmidt
Description
Sometimes Rust feels like magic when writing. It is often the case that this is because of typestate. A pattern where the state of a resource is embedded into a program’s types, making it hard for developers to write wrong code.
Rust’s type system, borrowing rules and ownership model make typestate a viable option and the pattern works better than in other mainstream programming languages. However, due to the unique and extensive way typestate is used in Rust new rustaceans often do not understand the pattern or use it in a wrong way.
Therefore, I will present and discuss typestate in my talk. The agenda will roughly be like this:
- What is typestate and how does it work
- Benefits and good use cases when to use typestate
- Disadvantages and when to not use typestate
- A condensed example (demo?) where we used typestate at Paessler AG to collect metrics of our applications in a type-safe way
Track
Technology & Community
Level
Intermediate