You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.
❯ cargo run
Compiling messages-obsidian v0.1.0 (/Users/jkgan/Developer/Rust/messages-obsidian)
error[E0505]: cannot move out of `ctx` because it is borrowed
--> src/lib.rs:30:3
|
25 |let hello = ctx.headers()
| --- borrow of `ctx` occurs here
...
30 | ctx.build_json(IndexResponse { message: hello.to_owned() }).ok()
| ^^^ move out of `ctx` occurs here ----- borrow later used here
error: aborting due to previous error
For more information about this error, try `rustc --explain E0505`.
error: could not compile `messages-obsidian`.
To learn more, run the command again with --verbose.
The text was updated successfully, but these errors were encountered:
jk-gan
changed the title
Can't use the header value from context in Response
Can't use the header value from context in Response due to owndership
May 26, 2020
error[E0515]: cannot return value referencing functionparameter`ctx`
--> examples/hello.rs:7:33
|
7 | app.get("/", |ctx: Context| async { ctx.build("Hello World").ok() });| ^^^^^^^^---^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|||||`ctx` is borrowed here
| returns a value referencing data owned by the current function
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I want to use the header value from request and return in Response:
and I get the error:
The text was updated successfully, but these errors were encountered: