Add lib.rs file

This commit is contained in:
flyingscorpio@clevo 2022-12-08 14:21:07 +01:00
parent 9f934c40ae
commit a69fa1eb90
2 changed files with 36 additions and 32 deletions

35
src/lib.rs Normal file
View file

@ -0,0 +1,35 @@
#![allow(unused)]
use serde_json::Value;
mod api_client;
use api_client::ApiClient;
mod ear;
use ear::Ear;
mod mouth;
use mouth::Mouth;
pub fn run() {
let listener = Ear::new();
let (stream, req) = listener.listen();
let mut sender = Mouth::new(stream);
// let data: String = get_data(&req); // TODO: update type
// let json_data = transform_to_json(&data);
let json_data = serde_json::json!({"test": 200, "foo": "bar"});
sender.send_data(json_data);
}
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);
todo!();
}
fn transform_to_json<R>(data: R) -> Value {
todo!();
}

View file

@ -1,34 +1,3 @@
#![allow(unused)]
mod api_client;
use api_client::ApiClient;
mod ear;
use ear::Ear;
mod mouth;
use mouth::Mouth;
use serde_json::Value;
fn main() {
let listener = Ear::new();
let (stream, req) = listener.listen();
let mut sender = Mouth::new(stream);
// let data: String = get_data(&req); // TODO: update type
// let json_data = transform_to_json(&data);
let json_data = serde_json::json!({"test": 200, "foo": "bar"});
sender.send_data(json_data);
}
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);
todo!();
}
fn transform_to_json<R>(data: R) -> Value {
todo!();
hephaistos::run();
}