Type-checked keypaths in Rust
Like a number of other folks, I have recently been exploring some slightly less well-worn corners of the Rust type system. In my particular case, this involv...
Interesting exploration on something I know is very useful and also really hard to do in a statically compiled language.
“Getting this working was… a journey. Beyond just stretching my comfort with Rust, it stretches my ability to communicate about Rust.
Our goal is simple enough: we want a way to generate code, at compile time, that can verify that a particular path exists, starting at a base type (the root) and ending up at some other type (the value). Importantly, we need to do this with only access to types; we can’t work with actual instances of those types. This sort of type-level programming is tricky in Rust.”Posted on 2022-07-14T04:58:16+0000