6 ms·
> a C API offers setBit(&gpioCtx, bitPosition, 1) You can almost certainly do the same in Rust in an unsafe block. You will be happier and more productive unl
by biorach 3y ago
> a C API offers setBit(&gpioCtx, bitPosition, 1)
You can almost certainly do the same in Rust in an unsafe block.
You will be happier and more productive unless you get bitten by the lack of locking, reference counting and mandatory initialisation. Which is actually quite likely.
- foooorsyth 3y ago> locking, reference counting and mandatory initialisation Don’t need any of this crap for a garage door opener. Most firmware is incredibly simple. pthread_mutex_lock(&mutex); setBit(&gpioCtx, bitPosition, 1); pthread_mutex_unlock(&mutex); Compiled with -Wall is fine and infinitely more readable that the Rust puke above, but you probably won’t need the lock or the warnings in your typical embedded project. The main issue with Rust appears to be that it invites masturbators that invent problem scenarios in their head and then overengineer every std lib API and crate available for consumption. Setting a bit on a dev board should simple. It should not be a chained mess full of operator soup.
- kbelder 3y agoPeople should be far more willing to use unsafe than they currently are.