witcher01
What Espressif is doing with their esp-idf and porting it to Rust is promising, but overall it still needs work. Using the toolchain to develop on the ESP32 was at least slightly painful half a year ago before they introduced espup[1], having to keep a patched LLVM around etc., and supposedly support for their Xtensa architecture is coming to LLVM soon[2] so this will improve in the future.
I'd also love to see Bluetooth support in esp-idf-svc[3], but they seem to be lacking people with the required knowledge to design and implement an abstraction for it[4].
[1]: https://github.com/esp-rs/espup [2]: https://mabez.dev/blog/posts/esp-rust-24-02-2023/ [3]: https://github.com/esp-rs/esp-idf-svc [4]: https://github.com/esp-rs/esp-idf-svc/issues/55#issuecomment...
There actually is! You can activate the lint with a `#[deny(clippy::integer_arithmetic)]` or by using the lint group `restriction`.[0]
// https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic
#[deny(clippy::integer_arithmetic)]
fn main() {
let (a, b) = (u32::MAX, 1);
//let c = a + b; // clippy: `error: integer arithmetic detected`
let (c, carry) = a.overflowing_add(b); // or any of checked_*, saturating_*, unchecked_*, wrapping_*
println!("{a} + {b} = {c} (carry bit: {carry})");
// output: `4294967295 + 1 = 0 (carry bit: true)`
}
Playground link: https://play.rust-lang.org/?version=stable&mode=debug&editio...[0]: https://rust-lang.github.io/rust-clippy/master/index.html#in...
btleplug[2] is great, but at least on Linux I prefer using bluez_async directly, which btleplug is just an interface for there[3], to avoid one more layer of dependencies.
bluez_async is quite similar to btleplug, and, from my experience, if you know one you can use the other just fine.
[1]: https://docs.rs/bluez-async/0.6.0/bluez_async/index.html
[2]: https://docs.rs/btleplug/0.10.4/btleplug/index.html
[3]: https://github.com/deviceplug/btleplug/blob/d6d8ba5486eba5d7...