Add some interfaces for needed functions

This commit is contained in:
flyingscorpio@clevo 2022-12-02 17:03:17 +01:00
parent 528bc181c9
commit d7a93ad0a8

View file

@ -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!();
}