Hello all,
Newbie here, coming from JAVA /Python.
I want to write some code that sends a JSON message to KAFKA, so I started looking for some crates to help me.
At docs.rs I find hundreds (great work, thanks guys)
But how do I find the right one for me, without trying them all ?
Any advice, specific or general, here would be very welcome.
I find crates.io comparable to pypi, so I would apply a similar search strategy to Rust crates as you apply to Python packages. That being said, crates.io search feature is notoriously low-tech and I've seen quite a few complaints about crate discoverability. Luckily, there is https://lib.rs, which is an opinionated index of crates.io. It's quite good IMO. When I search for kafka clients there, rdkafka β async Rust library // Lib.rs comes up pretty high. I then usually refine my search by looking at monthly downloads, release history, the repository and when I like what I see, I look at the docs and see if it fits my needs. If I think it does, I give the crate a try.
One of the things I use as a cheap sign of quality is the library documentation. Often, poor quality libraries simply have no documentation (that is, docs.rs will show the items but not any descriptive text for them). I also note when libraries technically have documentation, but it does a poor job of actually explaining how to use the library. These are not only signs that the library may be lower quality in general, but that it will be harder to attempt to use it, so itβs doubly useful for choosing what to spend my time on trying.
You can checkout Crate List - Blessed.rs. Which is a hand-picked list of the most popular/standard crates for many various usages. It should give you a good start for exploring the ecosystem.
Checking what dependencies and what dependents (reverse dependencies) a crate has is also very helpful.
For example I use the alacritty terminal. In it's Cargo.toml I find it has ahash, clap, log, parking_lot, and a few others as dependencies. I trust alacritty enough to use it. It works well. So I think probably those dependencies are crates that are trustworthy.
And the other way too.
For example if I were searching for serialization crates and I found serde, I could look at serde's dependents and see that it has very many. As I go through the pages I see many noteworthy crates that depend on serde. I could probable trust serde and would look into it an see if it does what I need.