Skip to content

Instantly share code, notes, and snippets.

@cdaringe
Created December 16, 2017 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdaringe/74282a8e08fc19f25c8a32dd3a01b97c to your computer and use it in GitHub Desktop.
Save cdaringe/74282a8e08fc19f25c8a32dd3a01b97c to your computer and use it in GitHub Desktop.
mod.rs
#[get("/thing")]
fn thing<'a>() -> content::Json<&'static str> {
let res : String = SOME_JSON_VALUE.dump();
return content::Json(res.as_str());
}
error[E0597]: `res` does not live long enough
--> src/main.rs:33:26
|
33 | return content::Json(res.as_str());
| ^^^ does not live long enough
34 | }
| - borrowed value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment