Where to find exercise about advanced feature in Rust

Rustling don't have exercise about smart pointer, concurrency programming or OOP.... Where I can find a good resource to practice those fields?

1 Like

Good question. I guess I personally have gotten this kind of practice from answering questions.

1 Like

Try to implement a bigger, real-life-ish project. Then, eventually, you'll need to use at least some of the more advanced features.

You will find additional exercises in this post about learning Rust in 2020. In particular note this recommendation in that post, and the reason therefore:

When I started to learn Rust, I read a lot of code in advanced crates on crates.io, as well as a lot of code for the rustc compier itself.

2 Likes

Thank you for suggestion.
But I don't understand clearly. How could "read a lot of code" improve programming skill?. We think like a human being, we improve our skill by practice, how we can read and read to improve our skill, we simply forget all think we not understand in very short time.
Can you explain more clearly?

@magikarp My personal favourite regarding (high-level) concurrency in Rust are Gregory Terzian's blog posts on Medium.

@jonhoo is another great educator and developer. He does very good Rust streams on Youtube. You should definitely check him out!:

Regarding your second question:

How could "read a lot of code" improve programming skill?

Think of it like this: If you don't know a certain concept or solution exists for a certain problem, you probably won't apply it in your code (because you don't know it exists). It is almost like a child seeing a bicycle for the first time. Although the child probably knows the concept of walking from point A to point B, it probably hadn't imagined that it is possible to sit on a "steel thing with wheels" and going from point A to point B much faster without doing much.
Of course, the child won't be able to ride that bicycle at the beginning, but now that it knows that something like this exists, it can practice it. :biking_man:

It is all about understanding the core concepts behind something and then apply it practically.

Hopefully, this could help you.

4 Likes

Thank you for suggestion.
I think if don't have exercise, I should create it by myself.
After all the more we contribute to Rust community will give benefit to ourselves.
-> the more popular and the more long live of this language -> the higher job position, higher salary, higher respect. Rust don't like go or python.... Rust is more hard and another level complexion
How can I demand a short solution from others?
I will try to improve my skill and contribute to rustling.

1 Like

First of all: Rust is not object-oriented.

If you're interested in concurrent programming then @cfsamson has written some great books about the subject:

Although those might be lower-level than what you're looking for. So instead I would recommend Ryan Levik's video tutorial on how to implement a simple Thread Pool in Rust.

6 Likes

Successful writers typically read lots from other writers. Sometimes it's also quite enjoyable to see how other people have solved problems.

Rust's standard library also contains lots of very good code. You mentioned that you were interested in smart pointers. Perhaps look and see how Arc and Rc are implemented?

3 Likes

To be honest, I find the best way to learn more advanced features/techniques is to just try bigger and bigger projects.

For example, you might not appreciate the power of concurrency until you create a linkchecker which tries to check that a bunch of URLs are valid.

Similarly, if you want to get better at writing sound unsafe code, try to wrap a native library.(see bindgen's tutorial or check out existing implementations).

I second this! @jonhoo's streams are really good, and he shows you the unedited version of what being a real (as in, using it for more than toy projects or contrived online challenges) Rust programmer is like.

Often it's as simple as looking at a type/trait/function and saying "that's cool, I wonder how they did that" then clicking the [src] button in the top-right corner of the API docs to check out the implementation.

A lot of the time just by seeing the different ways people attack a problem you'll learn new tricks and features of the language, or figure out what works and what feels awkward (i.e. not "idiomatic"). Most problems in computer science have been solved before, so by looking at one solution, you'll have the knowledge in the back of your mind and be able to reuse or adapt it when tackling your own problems.

4 Likes

Thank you for spending your time to answer me. I read it with careful

Thanks you. I will try your suggestion

Thanks for your help. I will try them

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.