8000 Example on rocket.rs homepage miscategorizes a `&'static str` as a `String` · Issue #2921 · rwf2/Rocket · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Example on rocket.rs homepage miscategorizes a &'static str as a String #2921
Open
@JonathanMcCormickJr

Description

@JonathanMcCormickJr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0