我正在使用 reqwest 查询 Google API:
let request_url = format!(
"https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=*\
&inputtype=textquery\
&fields=formatted_address,name,place_id,types\
&locationbias=circle:50@{},{}\
&key=my-secret-key",
lat, lng
);
let mut response = reqwest::get(&request_url).expect("pffff");
let gr: GoogleResponse = response.json::<GoogleResponse>().expect("geeez");
Run Code Online (Sandbox Code Playgroud)
该GoogleResponse结构体定义为
#[derive(Debug, Serialize, Deserialize)]
pub struct DebugLog {
pub line: Vec<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Candidate {
pub formatted_address: String,
pub name: String,
pub place_id: String,
pub types: Vec<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct GoogleResponse {
pub candidates: Vec<Candidate>,
pub debug_log: DebugLog,
pub status: String,
}
Run Code Online (Sandbox Code Playgroud)
这一切都会编译,我可以发出请求,但是我在字段中得到的结果String …
我想执行一个使用 PostGIS 包的自定义 SQL 函数的查询。例如,我可以使用 psql 运行后续查询:
SELECT * FROM places
WHERE earth_box(ll_to_earth(40.6333125,-8.659492), 20)
@> ll_to_earth(places.lat, places.lng);
Run Code Online (Sandbox Code Playgroud)
ll_to_earth和earth_box是 PostGIS 函数。我怎样才能让这个查询与柴油与这些值lat和lng作为输入?
我浏览了文档,但我无法理解它。
产生的线程之间是否存在父子连接?如果我从产生其他线程的位置杀死该线程,那些线程也将被杀死吗?这个操作系统是特定的吗?