this post was submitted on 11 Jun 2026
61 points (96.9% liked)

Programming

28377 readers
351 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS
 

I decided to adventure myself in Tauri development for a personal project, I read the entire Rust official book and followed the exercises. When I first started developing it was like if nothing I learned helped for real life projects.

Now after getting betting up every single time I touch my project, it seems I'm catching things slowly.

But I've never seen such a hard modern language, I used C and C++ before and it's incomparable.

you are viewing a single comment's thread
view the rest of the comments
[–] one_old_coder@piefed.social 20 points 2 months ago* (last edited 2 months ago) (3 children)

How many years of experience do you have in C++, and which version?

Rust can be a bitch in its syntax, and its borrow checker, but modern professional C++ can be way worse if you use concepts and metaprogramming.

[–] TheTechnician27@lemmy.world 16 points 2 months ago* (last edited 2 months ago) (1 children)

I'd also add that the borrow checker, to me, has a grossly overexaggerated difficulty/annoyance. It follows a simple set of a few easily learned rules, and in my experience, if you break one, it'll tell you which and where. I feel like the type of C/C++ programmers complaining about it are mostly the ones that have mountains of hidden memory etc. bugs in their C/C++ code that Rust actually makes them clean up.


Edit: Another class I find are those who kind of just feel out the borrow checker blindly without sitting down for 20 minutes to learn how ownership works.

[–] FishFace@piefed.social 5 points 2 months ago (1 children)

It depends what you're trying to do. Some data structures inherently do not work comfortably with a single-mutable-ownership model, and while they're not exactly ubiquitous, they're common enough. (My exposure to rust is through advent of code where they're more common than in the real world).

Rust doesn't make it impossible, but you need to convert everything to Rc Refcell and there's a load of annoying crusty boilerplate, so it is more difficult. And yes, the guards in those calls can prevent or expose nasty errors, but a lot of the time - in a simple app you're writing to learn the language - the logic that keeps everything safe is so simple that an experienced programmer doesn't even think about it, and then it's confusing because it's not clear what you're being protected from :)

[–] calcopiritus@lemmy.world 0 points 2 months ago (1 children)

Do you really need that much Rc? That is, do you really need multiple ownership for a piece of data in a single thread? It is rarely the case, many times you can get away by just borrowing that data.

ARc is harder to avoid, since across threads you often really need the multiple ownership.

Next is, do you need RefCell? Or would a simple Cell in some of the struct fields be enough?

[–] sukhmel@programming.dev 1 points 2 months ago (1 children)

I recently picked up embedded in Rust and I often stumble upon the pattern of taking buffer references into structures, and I would want to pack the buffer and the struct that uses it together, but I don't want to do self referential magic, so for now I keep buffers passed around everywhere

[–] calcopiritus@lemmy.world 2 points 2 months ago (1 children)

Yeah. That's a huge issue rust has. However, it can't be solved with Rc.

You either do it in safe rust, by "cheating" the borrow checker and storing a size offset of the buffer instead of a reference. Or just use unsafe rust and store a raw pointer alongside the buffer.

[–] sukhmel@programming.dev 1 points 2 months ago

I mean, I don't think that is a big issue, most of the time you don't need self reference, and when you absolutely need there is a way even if not very simple one

[–] JohnHammerSky@lemmy.today 2 points 2 months ago (4 children)

No I'm not professional, maybe I'm mistaken. I just know C++ and made a few simple things, and then I tried to do a few simple things in Rust but it's almost killing me. I'm asking myself if it's worth it.

[–] Mikina@programming.dev 10 points 2 months ago

I think that is kind of the main point of Rust, though.

It's pretty easy to make something in C++. But it will very probably have a lot of hidden issues with memory, undefined behaviors and the like. Rust doesn't let you make those mistakes that much, and forces you to do it correctly and securely the first time, which is why it is harder to get into.

They are mostly harmless and may never cause problems for you, but that's how you get critical RCEs that are 8 years old in a software that's now widely used.

If you don't need this kind "ease traded for security", in my personal opinion I'd go with Zig instead.

[–] one_old_coder@piefed.social 2 points 2 months ago

It's worth it because it's not C++. If I could, I would get a job writing Rust. Or Zig as that other guy said. My shitty opinion:

  • Zig <-> C
  • Rust <-> C++
[–] 30p87@feddit.org 0 points 2 months ago (1 children)

If your code touches sensitive stuff (eg. public networking) and needs to be low level, probably Rust (or another compiled memory safe language). Otherwise, just use C++.

[–] JohnHammerSky@lemmy.today 0 points 2 months ago (3 children)

But then what's the point of Tauri? I mean there are plenty general use projects in Tauri, why'd they chose Rust?

[–] fruitcantfly@programming.dev 4 points 2 months ago

Once you've learned it, Rust is just a very nice compiled language to work with.

You get higher level constructs than in C++, a language without a billion weird edge cases, a modern package manager, and much more. In my experience, my code written in Rust is more likely to work as intended, both because of the stricter compile-time checks, but also because language features like sum types make it easier to check the core logic at compile time.

I work in both C++ and Rust, among other languages, but these days I never reach for C++ for a new project

[–] calcopiritus@lemmy.world 3 points 2 months ago (1 children)

Do you really need tauri?

Tauri is for web devs that want to make GUIs with web tech in rust. You can do GUIs without web tech.

If you really want to make a GUI with rust, you can use iced.

If you just want a GUI with web tech, do it in JavaScript+html.

If you want a GUI without web tech and don't care the language, use a GUI toolkit for your preferred language.

Learning a GUI toolkit is hard. Learning a language is hard. Learning both at the same time is even harder than the sum.

[–] JohnHammerSky@lemmy.today 1 points 2 months ago* (last edited 2 months ago) (1 children)

Tauri provides native system plugins cross platform, that's what I want, paired with the fact it doesn't bundle Chromium, apps are lightweight and fast.

You can use Tauri with Iced too, it doesn't require web tech, the strong point of Tauri is the native system modules.

I thought about using native tools only but I'm planning on supporting Linux and Windows at the same time, so that's the appealing for me.

[–] onlinepersona@programming.dev 1 points 2 months ago (1 children)

I don't know what kind of a GUI you're building, but there are simpler options than Tauri out there. Slint comes to mind.

[–] JohnHammerSky@lemmy.today 1 points 2 months ago (1 children)

The GUI isn't important to be honest, just anything that doesn't look too outdated. I'm more interested on cross-platform native plugins, so I don't need to write all by hand. Slint seems to be less libre than Tauri, there are pricing on their website, even tho I understand it's free, still, I prefer to keep it away from strongly backed by individual company, especially if I don't know it well.

[–] calcopiritus@lemmy.world 0 points 2 months ago (1 children)

"plugins" is not a feature. What plugin specifically do you need? Most probably you can accomplish whatever you need with a library and iced. Plugin is just a fancy word for library.

[–] JohnHammerSky@lemmy.today 1 points 2 months ago (1 children)

Plugin are a feature when it provides cross platform abstraction for Windows, Linux, Mac, Android and iOS.

Doing it natively means I need to make a few thousands of extra ifs and maintain all different ifs for each platform, while Tauri provides it out of the box. Such as notifications, filesystem access, file opener, auto start, window management and etc...

[–] calcopiritus@lemmy.world 1 points 2 months ago (1 children)

There are plenty of cross-platform libraries in rust. In fact, most of them are. Since Rust is cross-platform at its core.

[–] JohnHammerSky@lemmy.today 1 points 2 months ago* (last edited 2 months ago) (1 children)

You probably mean general purpose libraries, when it comes to libraries that need to interact with OS native APIs Tauri does the heavy lifting by implementing for all platforms including Android and iOS.

I mean every language is cross-platform at its core, even Node, but for more complex calls things get really tricky.

[–] calcopiritus@lemmy.world 1 points 2 months ago

Go to crates.io, search for whatever you need. Most probably it will be multiplatform.

[–] dontbelievethis@sh.itjust.works 1 points 2 months ago

Tauri is for using webtech with rust irc.

So if you want to use rust in combination with JS frameworks like reakt you use tauri.

[–] kewjo@lemmy.world 0 points 2 months ago

if it's a hobby project you might check out zig, it has a lot of safety like rust but much simpler. just be aware major changes can happen as it's not a 1.0.0 release yet but from my experience their change guide is really thoughtful and lists any breaking changes and how to upgrade.

[–] x74sys@programming.dev 1 points 2 months ago

Yeah, if you can write modern C++, than Rust is going to feel much more natural and easy.