Function hors::get_answers_with_client [−][src]
pub async fn get_answers_with_client(
links: &[String],
conf: Config,
client: Client
) -> Result<String>
Get answers from given links.
This function will go through network to find out answers.
Examples
use hors::{answer, Config, OutputOption}; use reqwest::{Client, ClientBuilder}; let conf: Config = Config::new(OutputOption::All, 1, false); // please make sure that `cookie_store` should set to `true` in client builder. let mut client: Client = ClientBuilder::new().cookie_store(true).build().unwrap(); let links: Vec<String> = vec![ String::from("https://stackoverflow.com/questions/7771011/how-to-parse-data-in-json") ]; let answers: String = hors::get_answers_with_client(&links, conf, client).await.unwrap(); assert!( answers.contains( r#"data = json.loads('{"one" : "1", "two" : "2", "three" : "3"}')"# ) );
Returns
If search answers successfully, it will return the result string which can be print to terminal directly. Else return an Error.