4 ms·
I'll be keeping an eye on this then, because the above code is ridiculous; if it's the best (code-wise or performance-wise) way to do it in Rust, I can see the
by ykonstant 3y ago
I'll be keeping an eye on this then, because the above code is ridiculous; if it's the best (code-wise or performance-wise) way to do it in Rust, I can see the complaints.
- dralley 3y agoIt wouldn't be that much simpler if it wanted to do the equivalent thing in C. This is code for "set a pin in a completely thread safe way", whereas a lot of the comparisons are "set a pin". Which, as others have already pointed out, brings us to the very topic of this post. Rust prevents novices from messing up partly by forcing them to acknowledge ways in which the code might break, and it does that via the type system.