use std::collections::HashSet; const REQUEST_URL: &str = "http://www.pythonchallenge.com/pc/def/linkedlist.php"; fn get_next_nothing(current_nothing: String) -> Result { let client = reqwest::blocking::Client::new(); let resp = client.get(REQUEST_URL) .query(&[("nothing", current_nothing)]) .send()?; let body = resp.text()?; let nothing = body.split_ascii_whitespace().last().unwrap(); Ok(nothing.to_string()) } fn main() -> Result<(), reqwest::Error> { let mut nothings= HashSet::new(); let mut current_nothing = String::from("12345"); while !nothings.contains(¤t_nothing) { nothings.insert(current_nothing.clone()); current_nothing = get_next_nothing(current_nothing)?; println!("Next nothing is: {}",current_nothing); } println!("{:?}", nothings); Ok(()) }