Skip to content

Instantly share code, notes, and snippets.

@tobz
Last active July 2, 2018 23:53
Show Gist options
  • Save tobz/c0d3bff12d280b5755923876109e3846 to your computer and use it in GitHub Desktop.
Save tobz/c0d3bff12d280b5755923876109e3846 to your computer and use it in GitHub Desktop.
error[E0597]: `facade` does not live long enough
--> src/metrics/mod.rs:33:24
|
33 | let facade2 = &facade;
| ^^^^^^ borrowed value does not live long enough
...
39 | };
| - borrowed value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
lazy_static! {
static ref METRICS: MetricsFacade = {
let receiver = Receiver::configure()
.build();
let facade = MetricsFacade::new(&receiver);
let facade2 = &facade;
// Spawn our actual processing loop.
thread::spawn(move || run_metrics_loop(receiver, facade2));
facade
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment