An open question related to designing HALs: How does one keep track of Type State Machines? How do you document them to make it easier for other developers to understand/contribute code? I've been writing a HAL for a Cortex-M controller, and am thinking of using the Rust typestate to enforce APIs, but I think I need some way of keeping track of Type States, otherwise they get out of hand. Here's an example of enabling and disabling clock sources (AuxHfRco, HfXo, HfRco, LfXo, LfRco), but enforcing the constraint that whichever of 4 clock sources (HfXo, HfRco, LfXo, LfRco) is sourcing the High Frequency Clock (HfClk) -- that it cannot be disabled. https://gist.github.com/BogdanOlar/28b3a1b77f48b94bf1030a7b30ce3939#file-main-rs