4 ms·
Okay let's try it: 〉time The current time is: 12:38:36.95 〉cargo new foo 〉cd foo 〉cargo add axum 〉code . (and then copy-paste the axum docs hello w
by steveklabnik 4y ago
Okay let's try it:
〉time
The current time is: 12:38:36.95
〉cargo new foo
〉cd foo
〉cargo add axum
〉code . (and then copy-paste the axum docs hello world from docs.rs/axum into src/main.rs)
〉cargo build
〉time
The current time is: 12:43:37.44
Most of that is waiting on my crates.io index to update (which isn’t something that happens every time you start a project), and that, hilariously, the axum hello world also requires that you do a `cargo add tokio --features macros rt-multi-thread`, which they do not document, and I had to figure out myself. Most packages don't have that issue, and I'm filing a bug right now.
> I can have a Go net/http project up quicker than all the above just cause of muscle memory
I suspect that this has a larger impact on your experience than you're giving it credit for. You shouldn't discount familiarity, it's a huge bonus! And a good reason for you to do this stuff in Go and not Rust. But it doesn't mean it's universal.
Am I going to argue that Rails is not wildly productive? Absolutely not. But at least, for me, the package existing in the stdlib isn't the different factor here. Rails and Django both aren't in the Ruby and Python standard libraries either, you know?
- giancarlostoro 4y agoNever used axum, what does it bring out of the box? Interesting, maybe I've been out of tune from Rust for too long, I don't get paid to work with it so it is easy to fall behind! I'm really into things like Django and ASP .NET these days, and last I looked (months ago?) Rust doesn't offer anything fully batteries included yet (relative to those two frameworks), heck even Phoenix is really good in this regard.
- steveklabnik 4y agoThere’s nothing as out of the box full of batteries as Django. Rust, like Go, tends to use a more “libraries” approach than a “framework” approach. I like axum because it’s maintained by some prominent Tokio folks and fits my sensibilities. There’s lots of good choices out there.
- giancarlostoro 4y agoOn that note, how does a beginner do what you just did in under a minute? Versus, someone going through the walkthrough for Go and seeing you can make a website using net/http, because it is built-in and doing it? This is the nuance I'm talking about, built-in or at least core-maintainer supported libraries are usually easier to adopt because you know there is a lot of investment into them.
- steveklabnik 4y agoThe first chapter of the Rust book covers how to integrate dependencies in your workflow. The only thing not covered there is choosing which web framework to use. To do that, you either Google it, ask around, or just pick literally any of them and give it a try. You’ll notice the sibling comment did the same thing but with a different web framework they prefer. That’s great too. But other than the choice, it’s entirely agnostic. Another sibling even posted a step by step tutorial, if that level of specificity is helpful.
- yazaddaruvala 4y agoYou're right that adding dependencies is easy, but you're significantly downplaying the discoverability of quality crates for specific usecases. When people say "we need a rich standard lib" they are more interested in a "blessed set of crates" than a "it should be pre-downloaded with the compiler".
- steveklabnik 4y agoI mean I think my answer is the best anyone can do. It’s not as if there’s never packages competing with the standard library, and finding one you like and then always use is a one-time cost. There’s a ton of ways to find the answer to this question easily. It is of course true that you have to look. While two different ones were mentioned in this thread even, a new user would be easily served by either.