aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNerdyPepper <[email protected]>2018-07-10 13:10:03 +0100
committerNerdyPepper <[email protected]>2018-07-10 13:10:03 +0100
commit55bd0c5836e9b165c337df2856286d00493540ca (patch)
treea73f00d244ecebc1eab3f2ac4083af76eed58b1d /src
parent0adf755d690252108e5bd2be3d36f6d09bd612ed (diff)
Workaround to get links sidebar
Diffstat (limited to 'src')
-rw-r--r--src/main.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index ef8dc6a..ebf72d0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -37,7 +37,7 @@ fn search(s: &mut Cursive){
37 }; 37 };
38 let choose_result = SelectView::<String>::new() 38 let choose_result = SelectView::<String>::new()
39 .with_all_str(result) 39 .with_all_str(result)
40 .on_submit(|s, name| { 40 .on_submit(|s, name|{
41 s.pop_layer(); 41 s.pop_layer();
42 on_submit(s, name); 42 on_submit(s, name);
43 }); 43 });
@@ -68,16 +68,17 @@ fn on_submit(s: &mut Cursive, name: &String) {
68 // get article data 68 // get article data
69 let heading: String = name.clone(); 69 let heading: String = name.clone();
70 let url = query_url_gen(&name.replace(" ", "_")); 70 let url = query_url_gen(&name.replace(" ", "_"));
71 let mut res = reqwest::get(&url).unwrap();
72 let mut extract = String::new(); 71 let mut extract = String::new();
73 let mut link_vec: Vec<String> = vec![]; 72 let mut link_vec: Vec<String> = vec![];
74 73
75 // handle errors if any 74 // handle errors if any
76 match get_extract(&mut res) { 75 let res = reqwest::get(&url).unwrap();
76 match get_extract(res) {
77 Ok(x) => extract = x, 77 Ok(x) => extract = x,
78 Err(e) => pop_error(s, handler(e)) 78 Err(e) => pop_error(s, handler(e))
79 }; 79 };
80 match get_links(&mut res) { 80 let res = reqwest::get(&url).unwrap();
81 match get_links(res) {
81 Ok(x) => link_vec = x, 82 Ok(x) => link_vec = x,
82 Err(e) => pop_error(s, handler(e)) 83 Err(e) => pop_error(s, handler(e))
83 }; 84 };
@@ -90,6 +91,7 @@ fn on_submit(s: &mut Cursive, name: &String) {
90 let links = SelectView::<String>::new() 91 let links = SelectView::<String>::new()
91 .with_all_str(link_vec) 92 .with_all_str(link_vec)
92 .on_submit(on_submit); 93 .on_submit(on_submit);
94
93 s.add_layer( 95 s.add_layer(
94 LinearLayout::horizontal() 96 LinearLayout::horizontal()
95 .child( 97 .child(