asimov_serpapi_module/api/
google.rs1#![allow(unused)]
4
5use asimov_module::prelude::{FromStr, String};
6use serde::Serialize;
7
8#[derive(Clone, Debug, Default, Serialize)]
10pub struct GoogleSearchRequest {
11 pub q: String,
13}
14
15impl FromStr for GoogleSearchRequest {
16 type Err = url::ParseError;
17
18 fn from_str(input: &str) -> Result<Self, Self::Err> {
19 url::Url::parse(input).map(|url| {
20 let mut output = Self::default();
21 for (k, v) in url.query_pairs() {
22 match k.as_ref() {
23 "q" => output.q = v.trim().into(),
24 _ => {}
25 }
26 }
27 output
28 })
29 }
30}