this post was submitted on 18 Nov 2024
15 points (100.0% liked)

Rust Programming

8183 readers
36 users here now

founded 5 years ago
MODERATORS
 

I've only been coding with Python/Javascript since I started my career. I do APIs and websites frontend. I don't really understand what is interesting in learning an other language. For example, I could learn Ruby, but I'd do the same thing I already do.

Rust, C/C++ tho seem to me to be languages to code other things. Hence my question : what do you code? If possible, make distinction between personal projects and professional projects.

top 9 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 3 days ago (1 children)

I wrote a web server to store markdown documents with links between them, a sort of 'zettelkasten'. Now I've made it into a tauri app that runs on my phone, web server and all, and can sync with the main server in the cloud. Documents everywhere! Front end is in elm and not rust tho.

I've made a few other projects in rust, did a audio dsp thing that is a delay with web controls, made a blinky sketch for the rp2040.

Rust is cool because you can write pretty high level code in it, with lots of libraries to help out, or you can write bare metal code with no OS for embedded.

[–] lambda 1 points 3 days ago (1 children)

I'd love to browse your code. Do you have any of this in a public git repo?

[–] [email protected] 1 points 3 days ago

Sure, the web server is here and the tauri project is here. The syncing and tauri bit is pretty immature right now, but its getting there. There was an issue with media playback on android that had me blocked for a few months, but that's solved now.

[–] [email protected] 4 points 3 days ago (1 children)

Anything and everything, really.

I wrote an idle inhibitor in Rust, a GUI WiFi connection manager for my wife, an API client for WriteFreely, I contributed to a Wayland compositor (niri), wrote a library & CLI tools to talk to Kaleidoscope-powered keyboards. I wrote the frontend of my personal search engine in Rust too.

But I also built a Tauri application where the backend and the frontend were written in Rust too. No HTML or JavaScript in sight, not in the sources at least.

Professionally, the answer's the same: if I am allowed to write it in Rust, I will write it in Rust, whether it is a low-level library that talks with hardware, a GUI application, or some web related thingy, or anything inbetween.

[–] [email protected] 1 points 3 days ago (1 children)

Oh! That's nice. I have a question. Why Rust above all the other languages for web-related stuff?

Again, I do not have any opinion on this, all I know is Python so 💀

I have a project idea so you may convince me to try to code it in Rust 😅

[–] [email protected] 5 points 3 days ago

I use Rust mostly because I am comfortable working with it. It hits a sweet spot of often letting me write in a functional style, at often zero or very low cost. It has a lot of high quality libraries, for almost any purpose. And the language itself comes with great things too. Traits, Option, and Result are all things I miss when working in other languages like Go.

It's also a memory safe language that is also fast, approachable, and has a ton of good documentation. What's not to like?

[–] [email protected] 2 points 2 days ago

Various projects. With C I wrote drivers and networking stacks for embedded systems, with C++ I worked for years on a the networking layers of a now long gone smartphone OS. With Rust I've been doing hobby projects like a library+application (win/linux/macos) for controlling WeMo switches on the LAN. Most recent is a Memory+CPU usage monitoring applet for the nascent COSMIC desktop environment.

[–] [email protected] 2 points 3 days ago

My initial motivation to learn Rust was gamedev. Ultimately, you want high performance for games, which Rust can deliver.

Another area where Rust will be pretty much unavoidable in ten years is embedded computing.
So far, pretty much everything in embedded was implemented in C/C++, because you don't have a filesystem there, so you can't use a runtime, like Python, Java et al need. Rust doesn't require a runtime either and is finally a more modern language, with much better tooling.

Well, and where Rust (or C/C++) not requiring a runtime comes in handy, too, is for writing libraries. You can use it to create libraries, which can be called from virtually any language (via the C ABI).

But yeah, as the others said, essentially anything can be implemented in Rust. Moreso than most other languages.
At $DAYJOB, we've got a distributed system with edge components and a backend, as well as a CLI and a web frontend. All of it is implemented with Rust (and some HTML+CSS). For the web frontend, we're using WebAssembly (via the Leptos framework).
That is genuinely a solid reason for us to implement this in Rust, because we only need to know one language.

[–] [email protected] 3 points 3 days ago

The personal project I'm currently working on the most is Nucom, an implementation of Microsoft's Component Object Model.

The IDL compiler for it, which takes .idl files which define COM interfaces and outputs C/C++ headers/source files and Rust modules, is written in Rust.

Originally, this project was all C++, and everything but the compiler still is (which also likely isn't going to change since it involves building dynamic libraries which Rust does not do well at all), but I really did not want to go without Rust when writing a parser/compiler type thing because the language is so much nicer to work with.