Skip to content

Clarify that <str>::from_utf8* methods are aliases to core::str::from_utf8* functions #141079

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

Open
sorairolake opened this issue May 16, 2025 · 1 comment · May be fixed by #141112
Open

Clarify that <str>::from_utf8* methods are aliases to core::str::from_utf8* functions #141079

sorairolake opened this issue May 16, 2025 · 1 comment · May be fixed by #141112
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.

Comments

@sorairolake
Copy link
Contributor

Location

Summary

These methods are aliases to core::str::from_utf8* functions.

So I think it would be better to mention this as follows:

/// This is an alias to [`core::str::from_utf8`].

This also makes it more clear that the results of <str>::from_utf8* methods and core::str::from_utf8* functions are the same.

@sorairolake sorairolake added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label May 16, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 16, 2025
@hanna-kruppe
Copy link
Contributor

It’s probably better for the links to go in the other direction: the inherent functions are more idiomatic and easier to access, so they shouldn’t distract readers by pointing out the worse alternative. Actually deprecating the free functions is probably too much churn for the foreseeable future but now that the inherent methods are stable they can be recommended in the free functions’ docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants