It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
The name puts me off though. Why learn something called "rust"? How about "dirt" or "shit" or "pee"?

If there is a programming language called "juicy mango" or "steak with butter and french fries", learn that instead.
Post edited December 14, 2024 by timppu
avatar
Palestine: I will say that I have nothing but utter disdain for Python, as it has a tendency to distract beginners in such a manner that they will often become 'stuck on Python' (so to speak), and consequently, they will not gain vital experience with an essential (and efficient) compiled programming language.
People getting stuck on python is a testament to how useful it is :)
avatar
.Keys: First I tried setting up Cordova and Electron for the ease of HTML/CSS GUI creation, but I noticed, researching, that apps built with Electron tend to be badly optimized and I want it to work fast and well.
Notable exception (from what I've heard): VSCode.

(Although, in this case, it helps that the intended audience of that app is the same profession that the creators of that app belong to.)

avatar
.Keys: Nice to know you're creating a game on Rust!
If I remember corretly you were using Godot, by some other post long ago.
Why did you stop? Or Godot supports Rust? I don't intend to use Rust for creating games, but it got me curious now.
Godot does too much for my needs, basically. It's also rather opinionated, in its object-orientedness (and OOP doesn't fit how my brain thinks), and somewhat insular (no easy way to call C from GDScript, for example).

Main issue with Rust is that it's cumbersome to work with dynamic data (like what you'd read from JSON, for example).

There is a Godot extension that allows for Rust to be used with Godot. Haven't tried it, but it a apparently works.

Incidentally, the game isn't going to be pure Rust; I've used the mlua crate to embed a Lua (actually luau, the dialect that Roblox uses) interpreter into my project.

avatar
Gede: Is there any reason for you not to learn rust?
Learning is always good.
avatar
.Keys: People say its too different from C and Java in some ways.
Apparently Strings are complex on Rust and down the line code can get huge and complex, but then... "down the line" depends a lot, I know. Coming from other languages, traditional ones I mean, people complain its really hard.
There's two complexities here:
* Strings are UTF-8. This means that each character can be a different number of bytes, and that you can't treat arbitrary sequences of bytes as strings. (Well, you *can* if you use unsafe code, but putting non-UTF-8 data into a string will result in undefined behavior.)
* The whole String versus &str case. Strings are an owned type, while &str is a borrowed type. Learning the difference is one of the important aspects of learning Rust. (If you're familiar with C++, String is like the STL string class, and &str is like char *.)
Post edited December 14, 2024 by dtgreene
avatar
Palestine: I will say that I have nothing but utter disdain for Python, as it has a tendency to distract beginners in such a manner that they will often become 'stuck on Python' (so to speak), and consequently, they will not gain vital experience with an essential (and efficient) compiled programming language.
avatar
lupineshadow: People getting stuck on python is a testament to how useful it is :)
Python does have its disadvantages, however. Some people find that dynamic typing leads to issues (particularly since they are only found when you try to use the value, not at compile-time), and performance is poor compared to other languages. Rust does not have these issues.

On the other hand, Rust has its flaws, and they tend to be things that Python is actually good at.
avatar
thiagott: Considering this, I am assuming you don't know C++. (Please forgive me in case I am mistaken)

I would recommend you to first learn the basics of C++ just to understand how it works, including how to use shared pointers. C++ is a completionist language that became overlycomplicated for some tasks.

Rust was created to replace C++ in that manner. From a Java programmer perspective, you would think Rust is already hard, but from a C++ programmer, you would notice how easier it became!

And then you are going to understand why Rust was made like that. Then you will also comprehend this:
avatar
vv221: [x] - Only if you want to join the ranks of insufferable zealots
avatar
thiagott: And then you will like it a lot like many Rust programmers do!

To be honest, I don't see much demand for Rust programmers, not here at least.
Everyone seems obsessed with Python now and hardly wants to learn another language.
Sigh.
Thanks for the tips. Yes, I don't use C++.
About "Python being everywhere": Yeah... That's why the joke on the op. :P

- - - -

avatar
brouer: Try out Dart + Flutter before even thinking about Rust for that kind of thing.
A Web-Based wouldn't work for me. Dart apparently is based on this. Plus I personally dislike the idea of making everything Material UI (it seems to be the selling point of Flutter? Sorry if its not.) and bloated because of "multiplatform".

One thing that works everywhere, in my experience, is not optimized anywhere, except when is really possible to optimze anywhere with some ease, or the language itself is well optimized already...

Look at Unity and Unreal engines. This "we work everywhere", at one time in the future, end up costing us all time, money and development progress in my humble opinion.

Well, truth is, I really want performance above all else.
If you can optimize it to everywhere specifically, then its ok.

But then there's this data about Dart x Rust through some benchmarks:

https://github.com/jinyus/related_post_gen

https://medium.com/@tommyyy/the-dart-speed-035272e9d46d

https://programming-language-benchmarks.vercel.app/dart-vs-rust

Since I want performance for my use case, people's comments comparing Tauri vs Flutter on some sites is also a big no-no for me.

https://www.reddit.com/r/rust/comments/uqr1nq/tauri_or_flutter_for_rustdesk_desktop/

- - - -

avatar
Palestine: Honestly, I actively avoid non-C programming languages, as it had never been necessary (neither professionally, nor personally) to learn anything else; so, my knowledge of Rust is minimal.

I will say that I have nothing but utter disdain for Python, as it has a tendency to distract beginners in such a manner that they will often become 'stuck on Python' (so to speak), and consequently, they will not gain vital experience with an essential (and efficient) compiled programming language.

You should ask yourself: "Why should I learn another language?" -- If there is no practical purpose, abstain.
I understand. You have a point for your case. I just want to challenge myself and learn more instead of procrastinating on a language that I got curious about.

On Python:
Though I don't disdain Python, I dislike the mentality which is a cause of what you described on how Python spread itself.

One example of this is how JavaScript is all over the internet making it excessively bloated with scripts for UX/UI, and thus, prone to bad performance and abuse.

Python shines in DataScience by what I've seen.
But some are saying https://docs.pola.rs/ is going to grow more soon and is better and faster.. because it was written in Rust? I've never used it though.

https://www.statology.org/pandas-vs-polars-performance-benchmarks-for-common-data-operations/

https://www.datacamp.com/blog/an-introduction-to-polars-python-s-tool-for-large-scale-data-analysis

https://www.reddit.com/r/datascience/comments/16eiddh/comment/jzviilj/

- - - -

Just noticed how big this post became.
Sorry for that.
Post edited December 14, 2024 by .Keys
avatar
.Keys: First I tried setting up Cordova and Electron for the ease of HTML/CSS GUI creation, but I noticed, researching, that apps built with Electron tend to be badly optimized and I want it to work fast and well.
avatar
dtgreene: Notable exception (from what I've heard): VSCode.

(Although, in this case, it helps that the intended audience of that app is the same profession that the creators of that app belong to.)

avatar
.Keys: (...)
avatar
dtgreene: Godot does too much for my needs, basically. It's also rather opinionated, in its object-orientedness (and OOP doesn't fit how my brain thinks), and somewhat insular (no easy way to call C from GDScript, for example).

Main issue with Rust is that it's cumbersome to work with dynamic data (like what you'd read from JSON, for example).

There is a Godot extension that allows for Rust to be used with Godot. Haven't tried it, but it a apparently works.

Incidentally, the game isn't going to be pure Rust; I've used the mlua crate to embed a Lua (actually luau, the dialect that Roblox uses) interpreter into my project.

avatar
.Keys: (...)
avatar
dtgreene: There's two complexities here:
* Strings are UTF-8. This means that each character can be a different number of bytes, and that you can't treat arbitrary sequences of bytes as strings. (Well, you *can* if you use unsafe code, but putting non-UTF-8 data into a string will result in undefined behavior.)
* The whole String versus &str case. Strings are an owned type, while &str is a borrowed type. Learning the difference is one of the important aspects of learning Rust. (If you're familiar with C++, String is like the STL string class, and &str is like char *.)
I use VSCodium:

https://github.com/VSCodium/vscodium

It has some hiccups, but this is certainly on my CPU. They did a good job with it, indeed.

- -

Are you sharing your development anywhere? I really got curious to see how your game is going now. I wish you good luck!

- -

I did watch some videos on ownership, borrowship, Strings in UTF-8 and .unsafe.
Also about the ".clone" which, according to the video, is an easy but costly escape from ownership "problems".

It does make a lot of sense for safety.
It 'clicks' when you understand where they came from to do this with Rust.

Thanks for explaining!
avatar
.Keys: A Web-Based wouldn't work for me. Dart apparently is based on this. Plus I personally dislike the idea of making everything Material UI (it seems to be the selling point of Flutter? Sorry if its not.) and bloated because of "multiplatform".

One thing that works everywhere, in my experience, is not optimized anywhere, except when is really possible to optimze anywhere with some ease, or the language itself is well optimized already...

Look at Unity and Unreal engines. This "we work everywhere", at one time in the future, end up costing us all time, money and development progress in my humble opinion.

Well, truth is, I really want performance above all else.
* Electron, Tauri, and similar solutions are also web based.
* I think the performance issues aren't from it working everywhere, but rather because the tools used are high-level and not purpose-built to the specific task. For games with simple 2D graphics, for example, a purpose built game engine will far outperform one built with a general-purpose 3D game engine, whether Unity, Unreal, or Godot. (Case in point; Godot has to load and show a splash screen, while my game, at least in its current state, starts instantly once compilation is finished.)

avatar
.Keys: Are you sharing your development anywhere? I really got curious to see how your game is going now. I wish you good luck!
Not at this time.

I still haven't implemented characters, stats, or combat. All there is, at the moment, is some (limited) overworld exploration and a basic event system.

I'm planning on writing the first draft of the battle system next week.
Post edited December 14, 2024 by dtgreene
avatar
.Keys: A Web-Based wouldn't work for me. Dart apparently is based on this. Plus I personally dislike the idea of making everything Material UI (it seems to be the selling point of Flutter? Sorry if its not.) and bloated because of "multiplatform".

One thing that works everywhere, in my experience, is not optimized anywhere, except when is really possible to optimze anywhere with some ease, or the language itself is well optimized already...

Look at Unity and Unreal engines. This "we work everywhere", at one time in the future, end up costing us all time, money and development progress in my humble opinion.

Well, truth is, I really want performance above all else.
avatar
dtgreene: * Electron, Tauri, and similar solutions are also web based.
* I think the performance issues aren't from it working everywhere, but rather because the tools used are high-level and not purpose-built to the specific task. For games with simple 2D graphics, for example, a purpose built game engine will far outperform one built with a general-purpose 3D game engine, whether Unity, Unreal, or Godot. (Case in point; Godot has to load and show a splash screen, while my game, at least in its current state, starts instantly once compilation is finished.)
Thanks for correcting me and explaining.
Slint, Iced and Egui aren't web based though. (But then they're not similar right?)
avatar
.Keys: Also about the ".clone" which, according to the video, is an easy but costly escape from ownership "problems".
There are types that are reference counted, and all cloning them does is increment a reference count and copy a pointer. Rc and Arc are examples of this, and they do solve ownership problems if you don't need mutation. (If you *do* need mutation, you can get it via interior mutability, via Cell, RefCell, Mutex, or RwLock. Or UnsafeCell, if you really know what you're doing and are comfortable with unsafe code.)
I'm not sure about porting rust applications to mobile. (Especially not Apple), but for many other applications, sure. Remember, Apple makes you pay though the nose for every last bloody step of developing for them.

ICED might be your best bet for getting things done in terms of GUI, it's what COSMIC is building their desktop on.
Post edited December 15, 2024 by dnovraD
avatar
dnovraD: For what purpose do you intend to use this for?
That is indeed the most important question to ask.

No harm, and possible great benefit though, from learning another language anyway.

If I was younger, I'd maybe learn a few other languages. As I'm not, and are happy using AutoIt 99% of the time, I will just continue to do that.

If I was younger, I would probably focus on creating Android Apps.
avatar
brouer: Try out Dart + Flutter before even thinking about Rust for that kind of thing.
avatar
.Keys: A Web-Based wouldn't work for me. Dart apparently is based on this. Plus I personally dislike the idea of making everything Material UI (it seems to be the selling point of Flutter? Sorry if its not.) and bloated because of "multiplatform".

One thing that works everywhere, in my experience, is not optimized anywhere, except when is really possible to optimze anywhere with some ease, or the language itself is well optimized already...

Well, truth is, I really want performance above all else.
If you can optimize it to everywhere specifically, then its ok.

But then there's this data about Dart x Rust through some benchmarks:
Yeah, Dart is not going to compete with Rust for pure performance.

Do you mean you want to maximize performance everywhere? Including the UI?

That would mean building a Java/Kotlin layer for Android's UI, Swift for iOS, and probably using something like wxWidgets for Desktop.
Then you could build the shared code in Rust if you like.

I would still consider using Flutter for the UI. At least on mobile. It's pretty performant actually. Heaps better than Electron, Tauri and Cordova.

If iOS is a major focus for you, doing the shared stuff in Swift too is also worth consideration. It's a really nice and pragmatic language.

If a slight hit in performance is acceptable, also check out C# for cross platform development.

IMHO, for someone not already used to Rust, choosing it for mobile should only be considered if you are specifically interested in learning Rust (which is a fine goal in itself) rather than just Getting Stuff Done™.
avatar
.Keys: Also about the ".clone" which, according to the video, is an easy but costly escape from ownership "problems".
avatar
dtgreene: There are types that are reference counted, and all cloning them does is increment a reference count and copy a pointer. Rc and Arc are examples of this, and they do solve ownership problems if you don't need mutation. (If you *do* need mutation, you can get it via interior mutability, via Cell, RefCell, Mutex, or RwLock. Or UnsafeCell, if you really know what you're doing and are comfortable with unsafe code.)
Thanks! Will write this down for future reference.

avatar
dnovraD: I'm not sure about porting rust applications to mobile. (Especially not Apple), but for many other applications, sure. Remember, Apple makes you pay though the nose for every last bloody step of developing for them.

ICED might be your best bet for getting things done in terms of GUI, it's what COSMIC is building their desktop on.
Im not familiar with developing for iOS at all.
Can't we develop custom "apks", like on Android, for personal use and distribution for close people only that use iPhone?

The app I intend to do is for a group of musicians I play with, so its nothing "commercial". Just a little tool that matches our use case.
I know I can do something like this quite easily for Android, but one of the musicians uses an iPhone, so I'd need to develop for them too.
By what I know, anyway, the only thing you need is a digital signature or something, but the app can be fully open sourced and even uploaded to F-Droid, following certain guidelines, right?

Also, about Iced, people all over the internet praise it, but it feels a bit complicated to understand.
Slint is easier for someone learning Rust, but I will still decide what to do when the time comes.

Thanks for the tips too.

avatar
dnovraD: For what purpose do you intend to use this for?
avatar
Timboli: That is indeed the most important question to ask.
No harm, and possible great benefit though, from learning another language anyway.
If I was younger, I'd maybe learn a few other languages. As I'm not, and are happy using AutoIt 99% of the time, I will just continue to do that.
If I was younger, I would probably focus on creating Android Apps.
Yup.

avatar
.Keys: A Web-Based wouldn't work for me. Dart apparently is based on this. Plus I personally dislike the idea of making everything Material UI (it seems to be the selling point of Flutter? Sorry if its not.) and bloated because of "multiplatform".

One thing that works everywhere, in my experience, is not optimized anywhere, except when is really possible to optimze anywhere with some ease, or the language itself is well optimized already...

Well, truth is, I really want performance above all else.
If you can optimize it to everywhere specifically, then its ok.

But then there's this data about Dart x Rust through some benchmarks:
avatar
brouer: Yeah, Dart is not going to compete with Rust for pure performance.
Do you mean you want to maximize performance everywhere? Including the UI?

That would mean building a Java/Kotlin layer for Android's UI, Swift for iOS, and probably using something like wxWidgets for Desktop.
Then you could build the shared code in Rust if you like.
I would still consider using Flutter for the UI. At least on mobile. It's pretty performant actually. Heaps better than Electron, Tauri and Cordova.

If iOS is a major focus for you, doing the shared stuff in Swift too is also worth consideration. It's a really nice and pragmatic language.
If a slight hit in performance is acceptable, also check out C# for cross platform development.

IMHO, for someone not already used to Rust, choosing it for mobile should only be considered if you are specifically interested in learning Rust (which is a fine goal in itself) rather than just Getting Stuff Done™.
Thank you very much for the valuable insights.
As explained above when quoting Darvond, nope, iOS is not a major focus, as most friends that would use it are Android users.

Will still decide what to do.
Rust documentation is amazing.
One of the best documentations I've ever seen.
Looks like it was made for someone first learning to program.
Not kidding. Really helpful.
Maybe that's a good reason for its fast growth last years.

Tried to use Iced documentation... theres almost nothing there.
Really hard to learn as someone starting on it.
Devs said they will be working on it on time by a random post somewhere I read.
It does indeed look good for GUI development... but geez... Help. :p

Slint documentation is ok, really simple to navigate and understand too, like Rust's.
Unfortunately It lacks some more precise details for beginners on it like me.
Still could manage to create a working UI easily with buttons, colors, etc easily.

Anyway, thanks everyone for the recommendations and tips for specific hardware and situations/use cases.
Specially on mobile GUI and Rust logic so will have to look at each calmly later.

Thanks again.
Post edited December 17, 2024 by .Keys
avatar
.Keys: Slint documentation is ok, really simple to navigate and understand too, like Rust's.
Unfortunately It lacks some more precise details for beginners on it like me.
Still could manage to create a working UI easily with buttons, colors, etc easily.
Just commented this... and, surprise, they updated their documentation today.
This is incredible.

https://docs.slint.dev/latest/docs/slint/

Maybe we have some Slint devs around here? :P
Post edited December 18, 2024 by .Keys