Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify MutexGuard description #4264

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

proski
Copy link
Contributor

@proski proski commented Mar 8, 2025

No need to discuss if Mutex is a smart pointer. No need to mention LockResult, it gets overwhelming for beginners. Focus on MutexGuard and describe its properties in separate sentences.

No need to discuss if `Mutex` is a smart pointer. No need to mention
`LockResult`, it gets overwhelming for beginners. Focus on `MutexGuard`
and describe its properties in separate sentences.
@proski
Copy link
Contributor Author

proski commented Mar 9, 2025

I remember that after having read that chapter about a year ago (I was a complete beginner and it was my first book about Rust), I assumed that

  • lock().unwrap() gives me the data contained in the Mutex as is
  • MutexGuard is some invisible mechanism
  • Mutex is a smart pointer

Other books and practical coding experience helped me correct those misconceptions. This PR is an attempt to write something that would be less confusing to a Rust learner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant