Crate of the Week

I know this question probably shouldn't be here, but I wonder why people are so enthusiast about clap. As the rust community has a port of docopt for rust, it make me wonder how clap compares to docopt-rs.
Has anyone tried and could give some feedback in terms of usage convenience / drawbacks / advantages?

Sorry again for the off-topic question.

2 Likes

Sorry, I haven't tried either, so I'm not qualified to say anything enlightening on the topic. All I can say is from a cursory glance at the README, clap appears a little more full-featured than docopt.

With that said, nominations for next week's Crate of the Day are opened! I'm curious what you folks will come up with.

This is indeed off-topic. I'd suggest creating a new thread if you (or anyone else) wants to talk about it more.

Briefly: in my experience, most folks either love or hate docopt. Generating a parser from the usage string is quite a bit different than building one up explicitly like in clap. In particular, docopt is a black box. If it does something you don't like, it is hard to tweak it because its internals are so complex. Sub-commands also don't have a great story, but are doable. I bet @kbknapp could give a better comparison. :slight_smile:

3 Likes

To get us back on topic: I'd still like to see nominations! :smile:

I haven't used it yet, but I was always looking for a comfortable scraping lib, and select looks neat.

2 Likes
  • logger/env_logger - There's not a lot guiding newbies to these crates.
  • tempdir - A crucial tool.
  • tango and/or skeptic. These are tools for documenting and testing arbitrary markdown files.
  • pulldown-cmark. Dead-simple markdown parser.
  • rust-url. This is a production-quality URL parser, used by Hyper.
  • fnvhash. A very simple case - when the default hash map seems slow and you've got small keys, you might want this. I'm not sure this is the canonical implementation though. It looks unmaintained.
  • gcc-rs. Crates that want to build native code should use this.

Edit: missed the 'one suggestion per post' rule. Sorry.

3 Likes

fnv. This is the proper FnvHasher implementation. Maintained by Servo.

2 Likes

There is a wiki page at clap repo with brief comparison between docopt vs clap and getopts vs clap.
Maybe it will answer your questions.

6 Likes

lazy_static at least until we get better CTFE. This crate seems to creep into most of my projects.

7 Likes

So lazy_static it is.

I hereby declare the nominations for week 39 open. Perhaps we can rid ourselves of the tradition of winning last-minute nominations this time?

And it's Thursday and we don't have any nominations! Come on, people! Don't leave me hanging here.

You could always go back through the older nominations that didn't get chosen for that particular week. It seems like crates tend to get nominated once, then never again.

Aside: come to think of it, the forum structure itself is a rather poor way of organising this. For example, there are several crates that don't have their own post, so you can't vote for them directly. You can't "reset" votes for each week, nor can you tell how long ago the last vote was made (maybe a crate almost qualified for CoTW status a while ago, but is no longer relevant?).

Anyway, going through the backlog and checking the TWiR posts, I'd say ... well actually, I'll put it in a separate post so it can be voted for independently of the above rambling. :stuck_out_tongue:

1 Like

Re-nomination for quickcheck. "Automatic property based testing with shrinking."

It helps write property-based tests: you define some property and how to test it, and quickcheck feeds your test random inputs as it tries to narrow down the ranges within which the property fails to hold. Handy when the set of possible test cases is very large.

13 Likes

what about the good old https://crates.io/crates/rand ?

3 Likes

Maybe keep a list of nominated packages, and every week create a survey using Google Forms, letting people cast a vote for a whole week (while in the meantime, accept more projects for a next voting).

Once a project wins, it should be moved to a special list of weekly winners. Project that did not win, stay in the pool of candidates).

4 Likes

I was briefly surprised that Crates.io has something like https://www.reddit.com/r/random/ and Red-backed flameback - Wikipedia. Then I clicked the link.

1 Like

This nominating and voting would be great to integrate into Crates.io. Then crates' pages could have more to say than just stats and links. I'd be willing to help with the planning and implementation. Would an RFC be a good starting point?

1 Like

As useful as many of them are, I don't think Rust-lang crates make good nominations since I assume this whole process is to help community works get their time in the spotlight, especially the lesser-known ones.

For modifying crates.io I'd recommend starting out with some discussion (e.g. an issue, forum thread, etc), although an RFC probably isn't quite the right location for it. After that it should be relatively straightforward to implement on crates.io!

1 Like

This websocket library seems to be of high quality and well documented: https://crates.io/crates/ws

It's my nomination for next week.

1 Like