News for hackers. Stuff that matters.

witcher01

Re:Switching from C++ to Rust on Tuesday March 14, 2023 @10:51AM (#35152409)
Thanks for mentioning it. I already tried using it a few months ago and brushed it off as still being a WIP, but it still didn't work when I tried again just a few days ago. Asking in the Matrix chat when first trying it sadly only got me a "works for me" from the developers.

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...

Re:Switching from C++ to Rust on Tuesday March 14, 2023 @07:07AM (#35149684)
I don't know what the issue is but I've tried esp-wifi on the ESP32-C3 with the examples and nothing would run. It's a bummer since I'd have liked to leverage the Bluetooth support for my project.
Personally, I'm missing a more in depth write up. My takeaway has been "it doesnt matter because everyone had a different approach", not talking about the languages much beyond noting that one needs more declarations than the other. Nonetheless, this is still an interesting post. It does make the feeling of missing out come back in me, though, thinking about all the group work I've done during my bachelor's degree: No one is invested enough to make a plan or even attempt to write something resembling anything close to "clean code". But it's nice to know this isn't the norm!
Re:The Git source code audit, viewed as a Rust programmer on Wednesday January 25, 2023 @04:32AM (#34516316)
> But there is no clippy lint

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...

Re:Show HN: Hacking Bluetooth to Brew Coffee in GitHub Actions on Tuesday December 06, 2022 @06:16AM (#33878124)
I'm currently writing Rust for my bachelor thesis using bluez_async[1].

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...

Re:Things I wish everyone knew about Git (Part II) on Wednesday July 20, 2022 @10:02AM (#32165935)
merge and pull update the reflog just like rebase does, so both can be undone!