I finished the rust book and im not sure what i should read now to cover intermediate features such as phantomdata and cow
The Rust book generally gives you enough understanding of the language that you can start writing Rust code, relying on crate documentation for reference. In particular, the documentation for the standard library is quite detailed. It explains Cow
and PhantomData
. There is a search function if you are unsure where to find something in the documentation.
For more advanced topics, you may want to read through the nomicon, which is aimed at giving the knowledge needed for writing unsafe
Rust. It has a section on PhantomData
.
As far as I remember, I went over to the nomicon next. It doesn’t only contain information about unsafe
code but also some more advanced fundamentals.
The “features” you mention, PhantomData
and Cow
, are more like library contents than actual features. Well… arguably PhantomData
relying on language features to be possible… but Cow
is entirely a library-type that could’ve just as well be implemented in a 3rd party crate.
Actual language features the nomicon would introduce you to include
- unsafe operations of course… but also
- more information on lifetime
- lifetime elision
- higher-ranked lifetimes / trait bounds
- variance
- more information on method-call syntax
- more information on initialization checks and implicit drops
- probably more…
So it can be a useful read, even if your goal is not to write unsafe code anytime soon. With just the nomicon as a basis, unsafe code might still be hard to pull of correctly, anyways; but the read will be able to satisfy some curiosity as to how the more low-level details of Rust and its standard library might work under the hood, including e.g. a walk through how Vec
or Arc
are implemented, at least in principle. Even if your goal is not to retain many details, a guided look into such implementations can be both
- useful for a more precise understanding of those types and their trade-offs
- useful in case you are curious about different types in the future and want to have less trouble understanding implementation details that potentially include
unsafe
code
Of course, there’s also entirely different directions to go. The nomicon won’t teach you anything about async
for instance. Neither will it teach you about commonly used crates and their APIs. For either there are separate sources, e.g. there’s an (incomplete) async book, or the documentation of tokio for the former, the documentation of various crates for the latter concern, and for intermediate to advanced language constructs, there are other sources as well. E.g. some books, but I’m not deeply familiar with any I could recommend nor which free reading resources exits. I can recomment, if you like videos, the videos by Jon Gjengset; see this thread with a similar question for more on that and some other links.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.