Live data from Hacker News

Is Rust Ready for the Web Yet? (2020)

blog.devgenius.io

21–30 of 69 posts

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

#21
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.

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

#22

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.

In terms of database and framework design there are several Rust libraries that come close. Diesel for database and migrations and something like Rocket for the backend itself should be enough for a quick JSON API or Thymeleaf based page renderer.

Auto generated admin stuff is pretty rare in anything outside Django I think, though I don't see why one couldn't make those for Rust. I suppose most devs would probably want their CRUD APIs to function on their own and use those for management if performance is critical enough that you'd prefer Rust over something like dotnet or Java.

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

#23
post #14

Earlier quoted context omitted.

QT is still far ahead. This isn't a dig on Rust, but wherever Rust runs, so does C++. There are a lot of dimensions where Rust is better, but definitely not "runs everywhere" and "ecosystem".

My main gripe with QT is that apps created with it are, as a rule, ugly and non-native feeling. My suspicion is that this is because QT widgets sort of look like native widgets but aren’t quite there, causing it to fall into some kind of “uncanny valley” analogue.

From my experience, the same is true for most Rust frameworks. In fact, I don't think there's a single stable Rust GUI library that tries to accommodate system controls.

You can use the win32 API on Windows and Gtk on GNOME, but for KDE and all else you'll need to use some kind of Qt wrapper that has the problems you encounter.

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

#25

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's syntax took me a long time to get used to, and was sort of dazzling and difficult to read at first. Lifetimes and generics were especially difficult, it just looked like a jumbled mess to me.

There's (at least) three things going on in the snippet you posted. One is that actix, like most (all?) Rust frameworks, is macro based; that code would look pretty similar if it were written in Flask, but with different syntax.

Another is that the strict type system can lead to some heavy verbosity, eg having to populate the generic in `std::io::Result` with unit (`()`) just to say you're not returning anything.

Regarding `HttpResponse::Ok().body("Hello world!")`, the builder pattern is also pretty verbose and some people don't like it, but it's friendly to the type system and you can use it to provide really cool guarantees (like not being able to call `build()` until you've fully populated the builder).

Generally I'm of the mind that computers should conform to the needs of people and not the other way around, but programming language are a place where I'm willing to make many concessions, since as a rule humans are smarter than compilers.

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

#26

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.

In terms of database and framework design there are several Rust libraries that come close. Diesel for database and migrations and something like Rocket for the backend itself should be enough for a quick JSON API or Thymeleaf based page renderer. Auto generated admin stuff is pretty rare in anything outside Django I think, though I don't see why one couldn't make those for Rust. I suppose most devs would probably wa…

> Auto generated admin stuff is pretty rare in anything outside Django I think

Just wanted to say that anywhere from Ruby on Rails, to Laravel, to Yii, to... Pretty much every major web framework in the most common language used for web dev (php, python, ruby) has a builtin admin (among tons of other stuff).

Edit:

> Diesel

Diesel doesn't come close to where the ORMs of Django or RoR stand. Not by chance. Having to write by hand SQL (according to Diesel's docs) is something that modern web frameworks solved years ago. And I'm not even talking about automatic mapping of models to tables, automatic migrations, etc... Diesel is simply not anywhere near what a web dev would expect. Not saying that Diesel is bad, just that it's not in the same category where current ORMs stand.

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

#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?

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

#30

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.

In terms of database and framework design there are several Rust libraries that come close. Diesel for database and migrations and something like Rocket for the backend itself should be enough for a quick JSON API or Thymeleaf based page renderer. Auto generated admin stuff is pretty rare in anything outside Django I think, though I don't see why one couldn't make those for Rust. I suppose most devs would probably wa…

Rust database and migration story is really not that nice yet. SQLx is nice for pure SQL but doesn't have a good query builder story yet. Diesel is very clunky in comparison to Django ORM as soon as you get to anything beyond basic. Migrations are even less polished.

And in my experience going from Django to anything in Rust will be at least 10 times the boilerplate and some things will be very very annoying to handle, especially things like sharing parts of model, automating things like creation / update metadata for all models, and even sharing authentication mechanism for most routes can be annoying depending on the way you have to do authentication (in my case Firebase auth so authenticating sometimes does require making async calls... And that's a trouble).

Post reply on HN