Skip to content

Instantly share code, notes, and snippets.

@julienXX
Created July 10, 2019 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julienXX/6623fb366f9fced98e48bac2dc76f994 to your computer and use it in GitHub Desktop.
Save julienXX/6623fb366f9fced98e48bac2dc76f994 to your computer and use it in GitHub Desktop.
fn visit_url(s: &mut Cursive, url: &str) {
s.pop_layer();
match get_data(&url) {
Ok(new_content) => {
let mut select = SelectView::new()
.h_align(HAlign::Left)
.autojump();
s.add_layer(Dialog::info(url));
select.add_all_str(new_content.lines());
select.set_on_submit(|s,line| {
follow_link(s, line, url)
});
s.add_layer(
Dialog::around(select.scrollable().full_screen()).title(url),
);
},
Err(msg) => {
s.add_layer(Dialog::info(msg));
}
}
}
@julienXX
Copy link
Author

I'm getting:

λ cargo run
   Compiling asuka v0.1.0 (/home/julien/src/asuka)
error[E0621]: explicit lifetime required in the type of `url`
  --> src/main.rs:93:20
   |
81 | fn visit_url(s: &mut Cursive, url: &str) {
   |                                    ---- help: add explicit lifetime `'static` to the type of `url`: `&'static str`
...
93 |             select.set_on_submit(|s,line| {
   |                    ^^^^^^^^^^^^^ lifetime `'static` required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment