semver-trick
avr-hal
semver-trick | avr-hal | |
---|---|---|
15 | 30 | |
414 | 1,188 | |
- | - | |
2.8 | 8.8 | |
25 days ago | 10 days ago | |
Rust | Rust | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
semver-trick
-
Making Rust supply chain attacks harder with Cackle
Let's say crate B depends on crate A with a pinned dependency, and uses one of its types in a public interface.
Crate C depends on them both. It now can't bring in updates to A until B does, and when B updates that's a breaking change, so it better bump its major version.
Take a look at this teick, for example, for foundational crates updating their major version: https://github.com/dtolnay/semver-trick
Now imagine that being an issue every single patxh update.
-
The module system is too confusing
Rust modules require a tiny bit more definition up-front, but they neatly decouple the module hierarchy from file layout so you can reorganize code however you like in future, and they support very fine grained control of privacy (such as being able to say pub(super) and pub(crate)). In extreme cases, you can even re-export symbols from one module in another without it counting as a breaking change, so you have even more options for evolving your project without breaking existing consumers. Look at the the semver trick as an example of how powerful this can be and how much freedom it gives library implementors. (And even if you're only a library consumer, wouldn't you rather be consuming libraries by implementors that had more freedom and power?)
-
My first year with Rust: The good, the bad, the ugly
A library author concerned about this can use the semver trick. TL;DR: if your current version is 0.42, you can do a 1.0 release, then do a 0.43 release that depends upon your 1.0 release and re-exports all the symbols.
-
Does Rust have any design mistakes?
I mean for all the parts of the standard library that do not change, one could presumably use the semver-trick.
-
Rust is hard, or: The misery of mainstream programming
The semver trick can help with libraries at least when they go to unify the ecosystem. Release new versions that replicate previous APIs in a compatible way while moving to the standard library implementation.
-
Roadmap
Because you still run into the problem that's been seen when various important crates upgraded and either didn't use the semver trick or had downstream crates specifying Cargo.toml version requirements too narrowly for it to be effective.
- The Rust SemVer Trick (2019)
-
This Year in Embedded Rust: 2021 edition
It's called the "semver-trick" [1].
[1]: https://github.com/dtolnay/semver-trick
- The Semver Trick
-
The chip shortage keeps getting worse. Why can't we just make more?
The JVM is 114MiB on my machine. A near-minimal ggez program in debug mode is about 100MiB,¹ and ggez is small for a Rust application library. When you start getting into the 300s of dependencies (i.e. every time I've ever got beyond a trivial desktop application), you're lucky if your release build is less than 100MiB.
Sure, I could probably halve that by forking every dependency so they aren't duplicating versions, but that's a lot of work. (It's a shame Rust doesn't let you do conditional compilation based on dependency versions, or this would be a lot easier. As it is, we have to resort to the Semver trick: https://github.com/dtolnay/semver-trick/ — not that many people do that, so it's functionally useless.)
¹: I can get it down to around 8MiB with release mode, lto etc., but that significantly increases the build time and only about halves the weight of the intermediate build files.
avr-hal
-
Arduino Uno issue with interfacing with a dht11 sensor.
/* * For examples (and inspiration), head to * * https://github.com/Rahix/avr-hal/tree/main/examples * * NOTE: Not all examples were ported to all boards! There is a good chance though, that code * for a different board can be adapted for yours. The Arduino Uno currently has the most * examples available. */ #![no_std] #![no_main] use dht_sensor::*; use panic_halt as _; #[arduino_hal::entry] fn main() -> ! { let dp = arduino_hal::Peripherals::take().unwrap(); let pins = arduino_hal::pins!(dp); let mut serial = arduino_hal::default_serial!(dp, pins, 57200); let mut pin3 = pins.d3.into_opendrain_high(); let mut delay = arduino_hal::Delay::new(); ufmt::uwriteln!(serial, "{}", "waiting for sensor...").unwrap(); arduino_hal::delay_ms(2000); loop { match dht11::Reading::read(&mut delay, &mut pin3) { Ok(dht11::Reading { temperature, relative_humidity, }) => ufmt::uwriteln!(serial, "{}°, {}% RH", temperature, relative_humidity).unwrap(), Err(_e) => ufmt::uwriteln!(serial, "Error {}", "Unable to read").unwrap(), } arduino_hal::delay_ms(2000); } }
-
What are the scenarios where "Rewrite it in Rust" didn't meet your expectations or couldn't be successfully implemented?
I found the generics a lot less of a problem when I realized I could parametrize on things like embedded_hal::serial::Write instead of UsartOps https://github.com/Rahix/avr-hal/pull/264/commits/17ed15321cb8fcf8aedb1f8133be1f189eb06a6f
-
not entirely new to rust, but very new to rust+arduino,.... eli5 the differences between these projects?
I've come across avr-rust, avr-hal and both seem to have arduino stuff, wondering which is the most beginner friendly? (I have a bit of experience with the regular arduino IDE but want to switch over to doing all the stuff in rust for a challenge)
-
Hey Rustaceans! Got a question? Ask here (1/2023)!
fyi, a minor follow-up at https://github.com/Rahix/avr-hal/issues/388
-
Rust and arduino?
I have contributed a little to this. avr-hal I have done a couple little hobby projects with it as well, but I can't say it's the best thing out there.
-
Learning Embedded rust
All you need is in the documentation: https://rahix.github.io/avr-hal/arduino_hal/index.html even though reading the documentation without knowing what you're looking for can be quite difficult, so looking at some examples might be more helpful.
-
Five simple steps to use any Arduino C++ library in a Rust project 🦀
Rust language shares all advantages of efficient C++ code. With the rust community growing year after year, more and more people try using rust to program their Arduino boards. Consequently, the Arduino Rust ecosystem have significantly developed in the last couple of years. The Hardware Abstraction Layer for AVR microcontrollers avr-hal, Rudino library and ravedude CLI utility to make Rust development for AVR microcontrollers easier are just a few examples of the solid foundation developed so far.
-
The coincidental typos compiled..
Today I was toying with the arduino again, making an attached LED matrix print awesome messages better than it previously had. I wanted to use millis() found in the examples in the unsurpassed avr-hal crate, to orchestrate the duration it should show (part of) a character before moving on. But that is all besides the point. I made a few mistakes that coincidentally compiled and as such made me believe I was doing things right. (Perhaps I should note here that I am visually impaired so it is a bit easier for me to glance over smaller differences.)
-
From arduino to rust via avr-hal
There's a blink example in the repo for the avr-hal crate.
-
Hey Rustaceans! Got a question? Ask here! (34/2022)!
I'm trying to make an Arduino display text on an LCD using I2C (HD44780). So far, I've used arduino-hal from the avr-hal crate (github.com/Rahix/avr-hal) to program the Arduino, and I wonder if anyone happens to know of a library/crate which is compatible with it? So far I've only found ag-lcd which doesn't seem to work with I2C.
What are some alternatives?
lang-team - Home of the Rust lang team
avrd - AVR device definitions
cargo-llvm-lines - Count lines of LLVM IR per generic function
rust - Rust for the xtensa architecture. Built in targets for the ESP32 and ESP8266
rust-base64 - base64, in rust
ruduino - Reusable components for the Arduino Uno.
Thruster - A fast, middleware based, web framework written in Rust
llvm-project - The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
rust-quiz - Medium to hard Rust questions with explanations
atsamd - Target atsamd microcontrollers using Rust
serde - Serialization framework for Rust
rustc_codegen_gcc - libgccjit AOT codegen for rustc