I'm planning for a rather ambitious project, but not sure if I should choose rust (the new shiny thing) or stick to good ol Go (while I do have some issues with it)
I'm planning for a rather ambitious project, but not sure if I should choose rust (the new shiny thing) or stick to good ol Go (while I do have some issues with it)
Actix is the most mature of the Rust web frameworks. Axum is new but very promising. Rocket is popular but development is stalled at the moment since the main developer has been going through some rough times.
Firecracker, the software AWS Lambda runs on, is written in Rust: https://github.com/firecracker-microvm/firecracker
Mozilla wrote Servo, a browser engine, in Rust. Part of it has been integrated into Firefox a while ago:
> Mozilla incorporated the Servo CSS Style engine in release 57 of its Firefox Quantum browser.
https://research.mozilla.org/servo-engines/
It’ll be used in Android: https://security.googleblog.com/2021/04/rust-in-android-plat...
It’ll probably find it’s way into the Linux kernel: https://news.ycombinator.com/item?id=29485465
Ok one bit of AWS runs on Rust.
C/C++ runs 99% of the the worlds software including OS's/browsers/GUI's/Compilers/Virtual machines/Games/Aircraft/Spacecraft etc etc etc.
"It'll be" same was said of Java
This is from November 2020, I’d expect them to use it even more by now:
> But we also use Rust to deliver services such as Amazon Simple Storage Service (Amazon S3), Amazon Elastic Compute Cloud (Amazon EC2), Amazon CloudFront, Amazon Route 53, and more. Recently we launched Bottlerocket, a Linux-based container operating system written in Rust. Our Amazon EC2 team uses Rust as the language of choice for new AWS Nitro System components, including sensitive applications such as Nitro Enclaves.
https://aws.amazon.com/blogs/opensource/why-aws-loves-rust-a...
Mozilla wanted to push the boundaries of what's possible with a browser rendering engine and they felt like they couldn't do it safely with the existing languages, so they created their own. Doesn't that, alone, speak volumes for how useful Rust is?
> C/C++ runs 99% of the the worlds software including OS's/browsers/GUI's/Compilers/Virtual machines/Games/Aircraft/Spacecraft etc etc etc.
Now you're being disingenuous. Rust is still so young compared to those languages! Not to mention that the industries best served by Rust move glacially slowly compared to, say, the web. I bet we'll see significantly more adoption of Rust in 10-15 years.
That's cool, I guess, but also not particularly interesting.
- I've found it extremely fast to work with and iterate.
- I've been able to meld a lot of complex use cases to it. In-memory caches, worker thread pools, etc.
- It works great with testing, CORS, MySQL, Redis, forms, json, uploads, S3 clients, etc.
- Serde + the expressive type system is incredible (this is more about being able to use Rust, but Actix plays so well with it).
I'm using sqlx for nearly typified SQL checked at compile time. If we get a jOOQ-like DSL, I'll be overjoyed.
also, I'm interested in how you structure your code. is everything a crate? or you work in a giant namespace with different structs (sorry if this doesn't make sense I don't know much rust)
> for request schema, do you know how rust/ actix supports protobuf?
That's a great question! The serde annotations make it look like it should work. If not, there might be a plugin for it. Actix has a rather vibrant ecosystem of utility crates.
I've used Prost for protos once before (it felt like the more mature option), and the build integration was seamless. I was frustrated with how the IDE handled it at the time (Clion+Rust), which is one of the reasons I'm not using protos in Rust today. The IDE couldn't work out the types and everything touching the syntax tree near protos was opaque to the IDE. It was over two years ago the last time I checked the status of protos in Rust, so there's a good chance the situation has improved.
I didn't use Prost with Actix in particular, which is why I can't really provide insight there. It should be quick to set up a test.
I'm using two monorepos: one for frontend (yarn/typescript/react for three websites) and one for backend (all Rust; two servers and seven jobs). If I'd lumped it all together, I would have investigated protos more seriously. I should probably investigate using them again in the near future.
> also, I'm interested in how you structure your code. is everything a crate?
I'm using Rust workspaces to organize the backend monorep. I have about ten binaries, and five library crates that are shared between the various binaries. I also have a few vendored packages that aren't available on crates.io (newrelic-telemetry-sdk, etc.) I was told Bazel does a good job with build caching, so I'll investigate using that soon so I'm not always rebuilding the world.
> or you work in a giant namespace with different structs (sorry if this doesn't make sense I don't know much rust)
With the way modules work, there's next to no need for that in Rust. It's one of the most hygienic import systems I've used.
Overall, I'm extremely happy with the setup and it's been really productive for me.