3 ms·
I don’t know if this one of the embedded Hal libs or not. But what they do is to move the state of GPIO etc into the type system. So the type system maps a stat
by larusso 3y ago
I don’t know if this one of the embedded Hal libs or not. But what they do is to move the state of GPIO etc into the type system. So the type system maps a state machine. In practice it’s impossible to flip a bit on a pin which is not in the right configuration etc. My understanding was that this is the hot stuff that rust offers to embedded programming. Compiletime error handling. But in reality it can look overly complicated. Again I don’t know if this is a direct example or some other library. I played around with one on my blue pill a couple of years back. And yes the c api brings you faster results.
- sunshowers 3y agoI'm generally a fan of encoding invariants in the type system, but there's a balance to be had between that and the library becoming relatively unusable. I haven't used embedded Rust very much, but my general impression from afar, and from talking to people who are experts in the domain, is that the ecosystem leans far too much into the type system.
- larusso 3y agoI agree. But the point still is that the post wants to make it look like: this is how rust looks like. Look it is as bad as enterprise Java.
- sunshowers 3y agoI think from the lens the author is looking at, this is undeniably true. It isn't the complete picture but the folks working on embedded Rust should take it to heart.