diff options
author | Teddy Wing | 2018-11-11 01:51:57 +0100 |
---|---|---|
committer | Teddy Wing | 2018-11-11 01:52:25 +0100 |
commit | a9f405988052a49ad3ebbe2a5b1f0db80036b2cd (patch) | |
tree | 08d0f611e75af20c4dc26913bed9669c7952d071 | |
parent | b233d678f2109fecc7c6a4b9e2d65590819d96d1 (diff) | |
download | dome-key-web-a9f405988052a49ad3ebbe2a5b1f0db80036b2cd.tar.bz2 |
main(): Give the FastCGI closure access to the DB connection pool
Otherwise we get a borrow error:
error[E0373]: closure may outlive the current function, but it borrows `pool`, which is owned by the current function
--> src/main.rs:67:18
|
67 | fastcgi::run(|mut req| {
| ^^^^^^^^^ may outlive borrowed value `pool`
...
123 | let mut cx = match pool.get_conn() {
| ---- `pool` is borrowed here
help: to force the closure to take ownership of `pool` (and any other referenced variables), use the `move` keyword
|
67 | fastcgi::run(move |mut req| {
| ^^^^^^^^^^^^^^
-rw-r--r-- | license-generator/src/main.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/license-generator/src/main.rs b/license-generator/src/main.rs index fb29824..8e60d51 100644 --- a/license-generator/src/main.rs +++ b/license-generator/src/main.rs @@ -64,7 +64,7 @@ fn main() -> Result<()> { }, }; - fastcgi::run(|mut req| { + fastcgi::run(move |mut req| { let mut params = String::new(); match req.stdin().read_to_string(&mut params) { Ok(_) => (), |