I am new to coding and I am choosing rust as my first language

I recently started coding and would like my first programming language to be rust. I fully understand that this is very hard for a beginner who is not adapt with the basics and is not recommended but i am up for a challenge and i like how rust works differently than other languages. I would really appreciate if anyone help me in my journey with a few pointers and suggestions on how to proceed with learning rust. Thank You.

My advice: Take it easy, Don't over do it. If there are any concepts that you struggle to digest, give them some time and get back at them. If you still struggle, the community will always be here to try to help you.

One last thing: Getting started with Rust also has its advantages: You won't be carrying any baggage that would impede or slowdown your learning journey.

Read The Rust Programming Language book. And I mean read all of it and for every example and code block have your editor open and write it yourself down and experiment.

If you do it you will have great foundation for mastering Rust language. If it is to hard for you, then I recommend that you leave Rust alone and focus on using some easy language and learning programming itself. It can be hard (but not impossible) to learn programming basics and Rust language at the same time.

Welcome.

First off, while it may be a challenge you will certainly learn to program well if you learn rust first.

Rust is actually easy to learn:

  • the compiler gives great feedback and gives help
  • the documentation is amazing ("the book"s, the standard library, all the code you will interact with)
  • the examples you will see in staff library and popular crates are consistently really good quality
  • the community here is really helpful and friendly

But: rust requires you to learn or understand the fundamentals of programming. This is an advantage in your case, I guess. This is why they common vote is "rust is hard to learn" it's not, but really understanding programming is.

Resources to help (google them):

  • rust "the book"
  • rust by example
  • rust playground
  • rust std lib documentation
  • docs.rs
  • "let's get rusty" YouTube channel

Enjoy your learning journey!

Yes I will, I intend to take it slow and not give up even if it gets hard to understand thank you for your advice and support.

Yes, i have started with the book and I am always trying to do the exercises instead of just reading or memorizing the text. I will get stuck at times but I intend to not give up and keep on learning. Thank you for your advice and support.

The friendly community is also one of the reason why i like rust so much. I have started with the rust programming language book and I always try to do the exercises and try to make projects instead of just reading. I intend to not give up and learn rust step by step. Thank you for you advice and support.

Welcome.
Im am curious: How does one learn a programming language today?
In my time (1986) you had a DOS operating system and a BASIC interpreted language. It was cool to see that with a couple of lines you could read keyboard input and write character output - and it was as good as any other program that was available to me. Today, how to you set your scope so that you are happy with the result? (That question is independant of rust - sorry for that)
cu
Andi

Try to go really slowly and understand early on why certain features and rules are in place (borrowing rules, lifetimes, etc). It may require you to go back and understand some more fundamental concepts that would be a lot more "visible" in something like C. Feel free to ask here why the rust compiler disallows certain things, it'd be hard to have the full perspective on why things are as they are without, again, that prior C (et al) context.

There are two parts to account for there: the one about the "setting" and the one about "happiness". From personal experience, as long as you keep your expectations with regards to the end result open-ended, it's quite hard to find yourself suffering: be it from disappointment or frustration.

The cracks start to appear the moment you decide to go into it with an explicit (or implicit) intent to "accomplish/understand/get to X by the instant Y". You begin reading the book expecting yourself to finish it in a day or two or four; you expect yourself to instantly grasp each and every topic in each and every chapter: including the ones you've never dealt with before in your life; you expect to be able to go from nothing to the full-fledged project you had in mind, from zero to hero, from A to Z.

Then life happens. Your priorities change. Your attention is required elsewhere. Since you didn't account for any less-than-ideal scenario, you begin putting even more pressure on yourself in order to fulfill your original "plan". More pressure, more stress, more expectations, more disappointments. None of which would be a problem, if you weren't expecting yourself to be a 200+ IQ human being with a happily uneventful life, at no point requiring you to commit to any other task or project or learning endeavour you haven't chosen for yourself out of your own accord and intention.

Every "scope" is only as sensible as your prior knowledge, understanding, and experience with that particular scope's area of focus allows it to be. If you've never written a single line code in C or C++ or Rust, yet somehow expect to make it through the whole book without an ounce of confusion or frustration or mild sense of annoyance at things not "clicking" right away; you're setting yourself up for one hell of a miserable journey. Take it one step at a time, set yourself more goals along the lines of "keep learning about XYZ today", and you just might make it in one piece to the other side.

If you don't mind a bit of an unpopular/contrarian opinion: consider not constraining yourself to Rust. You are new to coding, which means you are new both to the higher-level / CS-side of the equation (variables/loops/functions/complexity/algorithms/paradigms), as well as to the lower-level / hardware side of it (stacks/heaps/memory/pointers/UB). Learning Rust for you means learning both. Glossing over the structure/architecture side entirely here, since there's little/no point in leading with them until you've gotten your feet wet and dirty with the basics. That will come too, a bit later on.

Spend as much time as you need on the CS basics first. If needed, pull out a JS console in your browser or a Python REPL in your terminal; and try to do the same thing there. Get the logic part (the "what" you can/should do) out of the way first, before tackling the lower-level details of "how" you're able/meant to be doing it in any one language in particular. Knowing what a vtable looks like in memory won't help you a bit if the program you write can barely do what it's meant to be doing.

Pick one book/course as your "highway", yet don't be afraid to take a "side road" once in a while. This is particularly helpful for the moments you find yourself "stuck" at any one thing. Ask your LLM to show you an example of how the same could be achieved in another language. I've found it quite invaluable myself to further "cement" the underlying concept. As good as it is, Rust too is just "a" programming language. What you can do here you want/should be able to do in any other PL. Albeit, with vastly different amounts of hair-pulling and/or anger management therapy sessions.

I would not say that variables, loops, functions are "higher-level". They are the first basic steps in programming. It has been said that all of programming is just "sequence, selection and iteration". I feel it should be as easy for a newbie to start programming and be introduced to these things in Rust as pretty much any other language.

I also have a feeling a raw beginner can get a long way in their introduction to programming with Rust without having to worry about the details of stacks, heaps, memory, pointers. There are "hand wavy" explanations of variables, their lifetimes and references that will work well enough,

That is the key to learning, although it seems somewhat unpopular these days.

Learning comes mainly from doing, not merely from reading about something or watching videos. Reading and videos can help, but they work best when they support actual practice.

Something you discover through your own experiment, especially when you are excited by the result, tends to stick much more deeply in your memory.

So: keep writing Rust code. A lot!

Compared to their real-world counterparts - with individual "variables" being represented by specific memory cell configuration in the RAM, in one of the cache lines, or in any of the CPU's individual registers - you can't tell me you think of them as anything but abstractions, yourself?

The first few basic steps, of course; yet abstract and higher level nonetheless. The loops don't exist in the machine code either: in asm, you only have your regular jumps and calls. The "sequence, selection and iteration" view itself is purely academic too, though still quite sensible and perfectly usable in algorithm design. Perhaps I should have led with the distinction in between the mathematical foundations and hardware/platform/OS specific implementation.

They most definitely can, though we can easily turn that one into a question of whether or not they should. Personally, I would love to get my hands on high-to-low-repeat programming manual. One that would start with the most basic of the basics, the simplest of the simplest, the highest-level of the heights; then pull you back all the way down to machine code in order to show and guide and explain what the in the world is going on down in the hardware-land for every "variable" and "loop"; then back and up again, into algorithms; then back down again, into OS-specific system calls.

Something that would make you "fascinated" with, not "worried" about, the details. Something that could help anyone grasp the whole at large, instead of cramming the syntax and/or the memory model and/or the expectations any given language happens to impose.

Alas, we make do with what we have.

Ah, see what you mean. Perhaps we are taking at cross purposes. Yes of course "variables" is an abstraction over memory bits in RAM, cache, register wherever. The "variable" idea hides all of that.

But when you said "high level ... CS..." I was thinking you meant more conceptually difficult requiring a lot to be understood before tackling them. Which is not the case.

What is it that you would like to program, that you'd think could take you within a day or a week, until you see visual / graphic output or text output? It needs to be of interest to you. I could give advice based on that. Background: I tutored a lot of bachelor level students in Java.

I’m probably not the best example of how to learn Rust, but Rust is also my first programming language.

I’m not an engineer, and I wouldn’t say I knew much about computers when I started. Concepts like GitHub, IDEs, compilers, the stack, and many others were things I first learned only after I had already begun studying Rust.

I started with The Rust Programming Language book. The first time I went through it, I honestly had no real idea what was being explained in more than half of the topics. After trying a few other resources, I came back to the book and studied it again. Even now, I’m still trying to properly understand topics like lifetimes, async, concurrency, macros, and smart pointers.

So, I know my way of learning Rust was probably not the most efficient or recommended path. But I have finally started writing small Rust applications, and the most useful thing I learned during this process is this:

As long as I don’t give up, Rust concepts slowly become clearer. Little by little, they stop feeling like mysterious things and start making sense.

Interesting. I am not aware of many people starting with Rust without prior programming and CS experience successfully. I can remember one person in this forum, perhaps 18 months ago, who was quite smart and made great progress within only a few months, but then disappeared and was never seen again.

How much time have you already investigated into learning programming with Rust, and do you think that you already understand the most basic foundations and would be able to create actually small projects? (Note, you do not really need macros and async for typically applications -- I started with Rust 30 months ago, and have not touched async and macros at all, as I do not need it, and as there is still a lot other more advanced Rust stuff to learn -- I recently finished "Efficient Rust" and am now studing Quinedots lecture notes, and after that perhaps the Gjengset book.

Perhaps you could make a list of other resources an absolute beginner would need, or list topics an unskilled person might find demanding in the official tutorial books. (Have you chosen the original, or the one from Brown University?)

Actually, your last statement shows, that it is not really true that Rust has a steep learning curve. I think there is nothing specific in Rust which is extremely complicated or demanding -- Rust is just quite complex and has a very long learning path.

I have gone through several Rust resources, including Beginning Rust by Carlo Milanesi, Rust for Rustaceans by Jon Gjengset, The Rust Programming Language, Rust in Action by Tim McNamara, Programming with Rust by Denis Marshall, Programming Rust by Jim Blandy, Command-Line Rust by Ken Youens-Clark, Rust for Network Programming and Automation by Brian Anderson, the Cargo documentation, the standard library documentation, and a few online resources.

I also read some broader technical books, such as Computer Networking by Kurose and Ross, and Linux by Michael Kofler.

I started learning Rust about two years ago, and I’m still learning. My goal is to reach a level where I can write the software for a remote-controlled vehicle that will collect data in my garden. I have also been trying to learn Raspberry Pi 5, Raspberry Pi Zero 2 W, and some basic electronics.

Even though I’m still learning Rust, I’m now trying to write the actual code for this vehicle directly. Most of the time I fail, but I’m doing it anyway, because I’ve finally started taking the “learn by doing” advice seriously.

Maybe I’m a bit late, but I’m trying to escape tutorial hell.