14
Arias95
5y

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?

Comments
  • 3
    You 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 :)
  • 1
    Subscribing to this thread
  • 0
    📌

    I too wonder why to use Rust...
  • 0
    @GTom that's kinda out of scope though...
  • 1
    I'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.
  • 0
    If 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...
  • 0
    @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!
  • 0
    @Wack This actually looks super interesting, I'm going to look at it
  • 1
    I'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.
  • 0
    @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.
  • 1
    Be 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.
  • 0
    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.
  • 0
    @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
  • 0
    @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.
  • 0
    @Arias95 pretty good from what I hear
Add Comment