Live data from Hacker News

Is Rust Ready for the Web Yet? (2020)

blog.devgenius.io

31–40 of 69 posts

Re: Is Rust Ready for the Web Yet? (2020)

#31

I won't use it to build a website until we get something like Django, or at least something like Flask's ecosystem. I want automatic (or at least easy and without DRY problems) DB migrations. I want an auto-generated admin page; auth; email. I will continue using Rust for embedded, 3D graphics, and desktop PC programs, but won't touch it for websites until this is solved.

We run https://FakeYou.com on Rust/Actix/sqlx, and I'm not missing the "batteries included" anymore. The type safety alone makes Python and Ruby a thing of the past for us. The tests being easy to refactor is really nice too.

Both sqlx and diesel have DB migrations. We use them. Sqlx is actually type checked too, which is awesome.

There are plenty of 3rd party auth and email packages (though we didn't use any, so I can't attest to them). It was quick enough to grow our own internal stuff, which we now reuse internally.

Rust is fantastic for working with audio or video on the server. We're starting work on rendering 3D workloads headlessly.

Another thing Rust can do that Python can't dream of - our servers have easy to manage background threads! We can launch async processes or have long-running background processes (infinite loops with periodic sleeps) that update singletons (Arc>) of important caches, which is way faster and more durable than Redis in certain cases. Actix makes these a breeze to work with.

Re: Is Rust Ready for the Web Yet? (2020)

#34

Maybe not with Actix, but certainly with axum: https://github.com/tokio-rs/axum Salvo is also great: https://salvo.rs

Am I missing something or is the Slavo “book” two pages and ends in plaintext “hello world” being sent to the client with no demonstration of routing, middleware, static assets, database, or templates?

Re: Is Rust Ready for the Web Yet? (2020)

#35
post #29

Recently I wrote a simple forest fire simulation to test out using egui in WASM. I was impressed by how simple it was to get up and running. https://maxbondabe.github.io/forest-fire

missing the most important part. the underbrush.

Yeah for sure, the goal was to learn egui and validate it's portability. The logic is largely lifted from the NetLogo model library (https://ccl.northwestern.edu/netlogo/models/Fire) and represents only the relationship with density and how far a fire is able to spread. I added a couple variations for fun (like using Perlin noise).

Re: Is Rust Ready for the Web Yet? (2020)

#36
Eh, HTTP with Rust is as fun as HTTP with C++. In both cases, there's people that swear they're very productive with it.

I'm building an app powered by Rust, and I love it, but I'd rather use Elixir for the Web facing part.

Perhaps when the whole async thing is more ergonomic I'll reconsider, but there is no chance any Rust framework can be as nice as any language running on the BEAM (or PHP, or Python, or Ruby, or Go, or Lisp), especially not as nice as Elixir can be as a website backend.

Use the right tool for the job.

Re: Is Rust Ready for the Web Yet? (2020)

#38

With all due respect does anyone else find Rust's syntax just horrible? #[get("/")] #[actix_web::main] std::io::Result HttpResponse::Ok().body("Hello world!") I mean, blegh! Anyway, just making conversation please don't take offense, some people think Ruby looks like ass.

Rust syntax is fine. Actix with its pervasive use of macros, ain't.

Re: Is Rust Ready for the Web Yet? (2020)

#39
post #27

I've built all my web backends in either Flask or Django - what are the selling points/advantages of using Rust vs. Python in this context? Certainly not arguing against it but am very curious and unfamiliar with Rust. If anyone has moved from Python to Rust for this kind of work, can you speak on your experiences with doing so?

It's written in Rust. Rust is at the state of its life where people will try to do anything and everything with it because they can. Some will stick, while some is just silly.

If I interviewed somewhere that used Rust for web apis, I'd be very hesitant because this isn't really what Rust is good at (yet?), and someone chose it because they wanted to try it more than use the right tool for the job.

Re: Is Rust Ready for the Web Yet? (2020)

#40
post #36

Eh, HTTP with Rust is as fun as HTTP with C++. In both cases, there's people that swear they're very productive with it. I'm building an app powered by Rust, and I love it, but I'd rather use Elixir for the Web facing part. Perhaps when the whole async thing is more ergonomic I'll reconsider, but there is no chance any Rust framework can be as nice as any language running on the BEAM (or PHP, or Python, or Ruby, or G…

Lunatic runtime for Rust to avoid the async parts might become quite nice in the future: https://github.com/lunatic-solutions/submillisecond

Not sure what it might take for someone to write database connectors for it but it does look promising.

Post reply on HN