I'm trying to brute force a web request to work with loops, however when I try to nest it with another brute force it gives me a borrow checker error says that it get's moved (val.text() is fn text(self), so it takes ownership). I get why it takes ownership, I just don't get why it matters. I'm not using val after I move it, so I'm confused.
Here is a simplified version of what I'm trying to do (also note that I'm writing this on the fly, so it may not be 100% semantically correct)
fn foo() -> String {
loop {
match server.send_request() {
Ok(val) => loop {
match val.text() {
Ok(val) => return Ok(val),
Err(err) => println!("Warning: failed to get query text; Error: {}", err)
}
},
Err(err) => println!("Warning: failed to query data; Error: {}", err)
}
}