From c5e3252ddcf7285ca4987cc8706f195a6be2467e Mon Sep 17 00:00:00 2001 From: bvanroll Date: Fri, 20 Jan 2023 16:05:32 +0100 Subject: [PATCH] interessant projectjen --- .gitignore | 1 + .idea/unnamed_chatgpt_project.iml | 5 +++- main/Cargo.toml | 4 ++++ main/src/main.rs | 38 +++++++++++++++++++++++++++++-- 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 94d0b77..d1db5a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Generated by Cargo # will have compiled files and executables main/target/ +data_prep/target/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html diff --git a/.idea/unnamed_chatgpt_project.iml b/.idea/unnamed_chatgpt_project.iml index d6ebd48..3343d27 100644 --- a/.idea/unnamed_chatgpt_project.iml +++ b/.idea/unnamed_chatgpt_project.iml @@ -2,7 +2,10 @@ - + + + + diff --git a/main/Cargo.toml b/main/Cargo.toml index 3fad2e3..f684772 100644 --- a/main/Cargo.toml +++ b/main/Cargo.toml @@ -7,3 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0.91" +rfd = "0.10.0" +chatgpt_rs = "0.6.0" \ No newline at end of file diff --git a/main/src/main.rs b/main/src/main.rs index e7a11a9..8afe2af 100644 --- a/main/src/main.rs +++ b/main/src/main.rs @@ -1,3 +1,37 @@ -fn main() { - println!("Hello, world!"); +use std::fs::File; +use std::io::{BufReader, Read}; +use serde::{Serialize, Deserialize}; + +#[derive(Deserialize)] +struct MiniHuman { + name: String, + gender: String, } +#[derive(Serialize)] +struct Human { + firstName: String, + lastName: String, + gender: String, + age: String, + country: String, + bio: String, + job: String, +} +fn main() { + let current_path = std::env::current_dir().unwrap(); + let res = rfd::FileDialog::new().set_directory(¤t_path).pick_file().unwrap(); + let mut file = File::open(res.as_path()).unwrap(); + let mut json_string:String = String::new(); + file.read_to_string(&mut json_string).unwrap(); + let MiniHumans: Vec = serde_json::from_str(&json_string).unwrap(); + while MiniHumans.len() > 1 { + let firstName: String = getRngName(&MiniHumans); + let lastName: String = getRngName(&MiniHumans); + + } +} + + +fn getRngName(miniHumans: &Vec) -> String { + return "".to_string() +} \ No newline at end of file