Where can I find some advanced tutorials?

I have studied a lot of basics and exercises related to Rust on the study page of the official website.

I have been writing in Rust for over a year, and I often use Clippy to help me standardize and improve my code. However, recently I noticed that with each update of Clippy, many advanced chain-of-procedures syntaxes became available that I hadn’t used before. This made me very surprised, but the results were truly impressive.

Therefore, I suddenly want to learn more about some advanced uses or syntax of Rust. Where can I find such information? :face_blowing_a_kiss:

I think that there's no "one true" style to write Rust, though different styles may even differ in generated code (e.g. when using iterator pipelines vs. loops) and in different scenarios sometimes one syntax may be preferred over another.

If you want to get more deeply into Clippy, you can enable and play around with the pedantic and nursery settings, but beware of false positives then.

Always remember to not get too clever. You're writing code for other people to read and, depending on your environment, you maybe don't want to set the stakes too high.

2 Likes

I got it,Very useful
"Make the code boring"


Additional question:

When I read crates like axum, tokio, bevy, etc., I always encounter files that are difficult to understand or various macros that make it extremely hard to read the source code. This has caused me great frustration, as I feel that I have only learned less than 0.1% of what is covered in Rust.

So now, I’m trying to figure out why reading these crates is so difficult. It seems that these crates have been developed over a long period of time, and many design principles have been added or used. This makes it difficult to read the code. It’s not because I know very little about Rust at all,right?

I don't think that tutorials will help much at this stage of your learning journey. I experienced this myself and I have used Rust much longer. At the beginning I learned the most from seeking help in the former IRC and later providing help to other beginners, but I always struggled with building more complex applications. It's not really depending on the language I guess, for me it was more like being locked in tutorial hell, because there aren't any tutorials showing and teaching this stuff.

In the last time I learned a lot from looking into other peoples code (for me some of the projects of the iced community), being active in a programming chat, reading "Rust for Rustaceans", watching some of Jon Gjengsets Videos and most importantly try to build your own stuff - while doing all the other things.

And according to your last question. From my experience there is sometimes a boundary, where your problem domains complexity can't be further reduced by abstractions in code (e.g. better described with code) - if you try, the opposite will happen and the code will become more complex again. In my opinion both tokio and bevy (I don't know axum) are solving problems of computer science, which are very complex by themself.

4 Likes

Thank you for sharing this with us.
I have summarized your experience into the principle of code more and meeting more code. The more you code and the more you meet code, the easier it becomes to handle things effectively.

One thing to keep in mind is that Rust will look very different depending on the domain, which is the result of Rust having quite a large scope as a language. A kernel or embedded Rust programmer probably would see Tokio/Axum/Tonic etc code and think its a completely different language, just like the backend dev would when they saw a sea of (unavoidable) unsafe blocks.

If you are writing a microservice it makes sense to be allergic to unsafe, use smart pointers, etc. If you are writing a device driver then maybe not so much.

I would look at mature and relied-on Rust code in a domain similar to that which you want to write and learn from that. Some of it is very "meta" and hard to understand (standard library for example) but you can look beyond that.

2 Likes

I ended by reading this forum and create own manual. I just keeping adding paragraphs in it continuing reading the board. I can share a link to it, unless not interested in.

1 Like

Hi MOCKBA, that sounds like a fantastic approach! I am definitely interested in seeing your manual. Learning by curating discussions from the forum seems like a great way to master advanced topics. Please do share the link!

You might find something of interest on these sites:

GitHub - ctjhoa/rust-learning: A bunch of links to blog posts, articles, videos, etc for learning Rust (unfortunately this hasn't been updated for years)

You might also try cloning the repo for some crate you want to understand better and asking an AI to create a markdown document explaining how it works and how it is structured. Or ask it to explain a macro you are having trouble grokking. Or why did they do this rather than that. You can even ask it to create Mermaid diagrams of structure, control flow, etc. VS Code with Kilo Code and Mermaid extensions works well for this.

2 Likes

You can find it here.

2 Likes

Thank you to everyone,

Your experiences are very useful,

I always believe that “the essence of humanity is being repeaters.”

Knowledge is shared and we progress together.

Thank you very much!

Is there a widely recognised place to learn from - how to put it - "certified good Rust code"?

I was looking at a particular crate not so long ago, and then mentioned it to someone else, who promptly replied, "That crate is poor, don't use it."

I, of course, had no idea how to gauge the correctness or quality of the crate I was looking at. Due to being a total Rust novice.

I hope by "certified good Rust code" you just mean good Rust code, because I have seen "certified" code that by no means was good code at all.

But jokes aside, I would just stick to code that's widely used and/or written by well known rust devs. And as yarn has pointed out above, stick to some crate that falls into the same problem domain you are currently working on / interested in. And I also think that reading bad code will improve your skills in the long run, too, at least if you don't adopt it blindly.

2 Likes