DEV Community

Discussion on: The Dumb Things I Did And How I'm Going To Fix Them

Collapse
 
deciduously profile image
Ben Lovy • Edited

Hah, well, no use being dishonest - the code doesn't lie!

Usage on stable Rust was why I jumped to actix_web instead of Rocket in the first place. While Rocket is a little easier to use at a first glance, I actually think actix_web is a better framework overall and not having to futz with nightly is a huge benefit. Rocket has a lot of proc macro magic which can obfuscate how things work if you want to deviate from the pattern.

That said, I've only used the old outdated API, today is my first go at the migration to 1.0. It's a pretty big shift, as it no longer even depends on actix. I can't speak to its relative usability now but I'm all about the commitment to long-term stability.

I'd also recommend you take a look at bare hyper, actix_web is a pretty heavy dependency and you might not need it. It will seriously reduce your boilerplate though.

Careful, the more Rust I write the less I want to write anything else ;)

Collapse
 
coreyja profile image
Corey Alexander

Thanks for the reply! Ya from my quick look it did definitely look like Rocket was using a lot of macros and stuff like that.

Oh wow, that's interesting that it doesn't depend on actix anymore lol. I don't know much about those projects but that's a fun fact!

It turns out that article was already on my Reading List! Gotta be better about picking things off that list!

Thread Thread
 
deciduously profile image
Ben Lovy • Edited

Sorry for the shameless self-plug, but hyper was actually a ton easier than I was expecting it would be, it's worth a try!

Actix is like Akka for Scala, it's a domain-agnostic implementation of the Actor model and I thought it was, you know, integral to how actix_web worked. While actors are a cool way to do concurrency, it was pretty boilerplate heavy - for instance, interfacing with a database in 0.7 meant defining an Actor specifically for the database that runs concurrently and having your handlers interact with that. It looks like this is all streamlined in 1.0, but I'm totally fuzzy on what the word "actix" means in this context now.

Collapse
 
coreyja profile image
Corey Alexander

Careful, the more Rust I write the less I want to write anything else ;)

Oh I know! I'm just getting started but it's already made me want to re-write some projects in it!