Poeira: Raspberry Pi + PMS5003 air quality sensor

https://sr.ht/~goorzhel/poeira/sources
https://goorzhel.com/libpoeira/libpoeira/index.html

Poeira — apart from being my first Rust project — is a service for gathering metrics from a Plantower PMS sensor through a Raspberry Pi. The name is Portuguese for dust and pronounced poh-AY-rah.

It performs well enough so far, but I'd like to tag a 1.0.0 release someday, and for that I humbly request your help rooting out any Rust blunders I've committed, no matter how infinitesimal.

Hi Antonio, congrats on your first Rust project!

If you have two crates with one depending on the other, it's convenient to maintain both in the same git repository and use a Cargo workspace. This way other contributors just have to clone one repository (instead of needing to clone two in the same directory). Sidenote: I think Rust crates usually use suffix notation so e.g. poeira-lib instead of libpoeira (I think the most common naming scheme is foobar for the lib and foobar-cli for the command-line interface).

I took a quick look over the source code and didn't notice anything to improve; your error handling looks good. Documentation-wise you could extend the root module documentation to explain what the library is for and add some example code. You might also want to improve the Formatter documentation ... giving an example of the CLI in the API documentation is confusing ... you might want to document that the string doesn't contain a newline (as you might expect for CSV). CSV_HEADERS could also use a doc comment hinting that it's meant to be used with Formatter::CSV.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.