Add some interfaces for needed functions
This commit is contained in:
parent
528bc181c9
commit
d7a93ad0a8
1 changed files with 26 additions and 0 deletions
26
src/main.rs
26
src/main.rs
|
@ -2,10 +2,36 @@ mod api_client;
|
|||
use api_client::ApiClient;
|
||||
|
||||
fn main() {
|
||||
let url = recv_request();
|
||||
let req: String = parse_url(&url); // TODO: update type
|
||||
let data: String = get_data(&req); // TODO: update type
|
||||
let json_data = transform_to_json(&data);
|
||||
send_data(json_data);
|
||||
}
|
||||
|
||||
fn recv_request() -> String {
|
||||
todo!();
|
||||
}
|
||||
|
||||
fn parse_url<T>(url: &str) -> T {
|
||||
todo!();
|
||||
}
|
||||
|
||||
fn get_data<T, R>(request_data: T) -> R {
|
||||
let api_client = ApiClient::new();
|
||||
|
||||
let res = api_client.get_ip("8.8.8.8");
|
||||
println!("{:#?}", res);
|
||||
let res = api_client.get_url("debian.org");
|
||||
println!("{:#?}", res);
|
||||
|
||||
todo!();
|
||||
}
|
||||
|
||||
fn transform_to_json<R>(data: R) -> serde_json::Value {
|
||||
todo!();
|
||||
}
|
||||
|
||||
fn send_data(data: serde_json::Value) {
|
||||
todo!();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue