Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
CptFox16166yYou could have another go at one of your old projects, with the goal to use Rust's compiler as a tool to help you build it better this time around ?
Rust will probably force you out of some patterns you might have used, and you might find some lessons in what it'll forbid you to do :) -
Geoxion9016yI'm looking into rust as well to see if it could replace an existing C++ project. I want to redo it anyways, so it's the perfect time to start in a new language.
-
Wack61916yIf you don't feel like "just" writing a program but you would rather build a web app, take a look at https://rocket.rs/ if you currently don't have an idea of what to write, try rewriting your personal site in rust or an old project...
-
Arias95496y@CptFox That's actually a good idea, I might rewrite a home automation project I did like a year ago. Looks like it's possible to cross compile so it's perfect for some of my needs. Thanks!
-
MehMeh76yI'd suggest doing coding challenges first for learning.
Advent Of Code, Hackerrank, CodeWars, ... something like that.
I found them perfect for learning new languages.
@Geoxion
Even if in the end you don't like it, learning rust will make you a better C++ programmer. At least for me that was the case.
My advice: Avoid unsafe like the plague. Not because it's hard (after all, unsafe rust is basically just C++) but because it provides an easy escape that could hinder you from adjusting your thinking.
Old saying: "A language that doesn't change the way you think about problems is not worth your time."
When doing rust, try to think about data and how it should move through your app.
When you find yourself jumping through hoops, rethink your approach.
Rust might seem very similar to other languages you know. The differences are subtle. It's very easy to skim over ownership rules and pretend you fully understood. -
Geoxion9016y@MehMeh I fully agree! But the project is embedded, so there will have to be a little bit of unsafe code to read and write the registers.
But that will be in a safe wrapper. So I think that will be ok. -
MehMeh76yBe sure to check the Rust Embedded book: https://rust-embedded.github.io/boo...
There are Hardware Abstraction Layer (HAL) crates for a few architectures so it might even be possible to avoid unsafe completely. -
As someone who isn't a cpp Dev, I'm having the same issue. The language is really intimidating and I don't know a good idea to use it with.
-
CptFox16166y@Techno-Wizard Try some relatively simple things first. Things where you won't get trapped in an architecture that would cause the compiler to scream at you in confusion.
And remember that .clone() is not your enemy, it's literally called any time you use = in c/cpp.
Rust is hard at first, mostly because you'll think "WHY ARE YOU NOT LETTING ME DO THIS, I DO IT IN OTHER LANGUAGES AND IT WORKS FINE", but let the wookie win, whatever it's not letting you do, would probably bite you in the ass whenever you'd get concurrency involved -
Arias95496y@Techno-Wizard I am a C++ dev and normally have a lot of fun with microcontrollers and home automation projects. That for C++, I don't know how's the current state of embedded Rust.
Related Rants
I've been eyeing Rust for quite a while and it definitely caught my curiosity, specially after the SO survey. Now I want to learn Rust but I normally need to work on a project in order to actually learn and keep myself motivated, yet I have no idea what to start, any ideas?
question
rustlang
rust
systems programming