-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Option.as_ref() possible example mistake? #104476
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
Comments
Transferring to the rust-lang/rust repository, as that is where the standard library documentation is. I think it is trying to illustrate the conversion from |
No, that seems fine; what confuses you (or leads you to the &str conclusion)? I could follow |
I guess I'm extremely confused then. If I have an |
You can call
|
Okay, sorry, I understand now that comment is talking about the upcoming example instead of discussing as_ref() in general. In order to help others not experience the same confusion I did, perhaps I could suggest a tweak to the wording, such as: |
memory address |
@rustbot claim |
url: https://doc.rust-lang.org/nightly/core/option/enum.Option.html
function: as_ref()
Examples:
Converts an Option<String> into an Option<usize>, preserving the original.
Perhaps I'm just confused, but shouldn't that say:
Converts an Option<String> into an Option<&str>, preserving the original.
The text was updated successfully, but these errors were encountered: