rust-lang / rust-lang/rustlings
Confusion about as_ref_mut
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 64.2k
- Forks
- 11.3k
- Avg merge
- 5h 24m
- Merged PRs (30d)
- 2
Description
Hi!
Thank you for your excellent work on the Rustlings exercises. Most of the tasks were easy to follow and had a clear purpose. However, I found myself completely stumped by the as_ref_mut exercise, as I had no idea what I was supposed to do or why I would use this language construct at all.
Initially, I thought the goal was to write my own AsRef implementation for some sort of generic type or even for str itself. Neither reading the documentation nor searching for additional information helped to clarify this. In the end, I had to resort to looking at the solution files to figure out what to do. 😞
I humbly suggest the following improvements for the as_ref_mut exercise:
- Provide a bit more background on why
AsRefis needed and how it is commonly used. - Use more practical example where
AsRefreally adds significant value. - Let the user implement their own
AsRefimplementation for a type as a learning exercise. - Consider removing the generics, as it was a bit distracting (at least for me).
Thank you again for your hard work on this project!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the as_ref_mut exercise and the solution files referenced in the issue, then compare them with the existing Rust documentation. Decide which explanation, example, and exercise changes are in scope; done means a beginner can understand the purpose of AsRef and complete the exercise without consulting the solution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- content
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100