Hello, I don’t understand for what my variable does not live long enough. I’ve tried many things but nothing works.
error[E0597]: `PHRASE` does not live long enough --> src/main.rs:23:34 | 23 | let content: &[u8] = PHRASE.as_bytes(); | ^^^^^^ borrowed value does not live long enough ... 26 | }) | - borrowed value only lives until here | = note: borrowed value must be valid for the static lifetime... error: aborting due to previous error For more information about this error, try `rustc --explain E0597`.
My Code:
service_fn_ok(|_| {
let mut PHRASE: String = "Hello World!".to_owned();
PHRASE.push_str("what do you want");
let content: &[u8] = PHRASE.as_bytes();
return Response::new(Body::from(content));
})