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

Example on rocket.rs homepage miscategorizes a &'static str as a String #2921

Open
2 tasks done
JonathanMcCormickJr opened this issue Mar 13, 2025 · 0 comments
Open
2 tasks done
Labels
docs Improvements or additions to documentation

Comments

@JonathanMcCormickJr
Copy link

What kind of documentation problem are you reporting?

Technical Problem

Where is the issue found?

https://rocket.rs/#routing-panel

What's wrong?

For the "Ins and Outs" / "Routing" panel, it provides an example where the index function has a signature showing that it returns a string of type &'static str, however, in the text immediately below the example, it says "The handler returns a String.", which is a different type under the Rust ownership system.

Image

The simplest solution to this issue would be to change the text to instead read as "The handler returns a &'static str."


On the other hand, if we were to prefer for the example to actually return an owned String instead, then we must update the example code to reflect it, perhaps with something like this:

#[get("/")]
fn index() -> String {
    "Hello, world!".to_string()
}

System Checks

  • I confirmed that the issue still exists on master on GitHub.
  • I was unable to find a previous report of this problem.
@JonathanMcCormickJr JonathanMcCormickJr added the docs Improvements or additions to documentation label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant