aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-11-16 23:39:15 +0100
committerTeddy Wing2017-11-16 23:39:15 +0100
commit84d4e100e93a5e3b630eaa355120871af46667d2 (patch)
treed8699585eba9f86a59b7e66f3303d7ecae9dcd30
parentf9b13604484fa7924efb8cde0dd26de0276065ff (diff)
downloadkipper-84d4e100e93a5e3b630eaa355120871af46667d2.tar.bz2
main(): Add comment above cloned command line variables
Turns out the easiest way to share these variables between both closures really is to clone them. Thanks to 'durka42' on Mozilla#rust-beginners for explaining the problem to me. In durka's words: > both closures are required to be 'static > so you can't send references across > and the router handler has to be callable multiple times so you can't consume anything (that's the error you got) It's also possible to share references using Arc, but that seems more complicated than it's worth here. Just do the copy and be done with it.
-rw-r--r--src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index c93d616..8c4fbfb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -139,7 +139,9 @@ fn main() {
},
};
- // TODO: Get rid of clones
+ // Clone so we can use these values in the thread
+ // closure. Since both closures are required to be
+ // 'static, we can't use references to these values.
let jenkins_url = jenkins_url.clone();
let jenkins_user_id = jenkins_user_id.clone();
let jenkins_token = jenkins_token.clone();