interessant projectjen

This commit is contained in:
2023-01-20 16:05:32 +01:00
parent b21dd9b590
commit c5e3252ddc
4 changed files with 45 additions and 3 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
# Generated by Cargo # Generated by Cargo
# will have compiled files and executables # will have compiled files and executables
main/target/ main/target/
data_prep/target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # 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 # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html

View File

@@ -2,7 +2,10 @@
<module type="JAVA_MODULE" version="4"> <module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true"> <component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/data_prep/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/data_prep/target" />
</content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>

View File

@@ -7,3 +7,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.91"
rfd = "0.10.0"
chatgpt_rs = "0.6.0"

View File

@@ -1,3 +1,37 @@
fn main() { use std::fs::File;
println!("Hello, world!"); 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(&current_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<MiniHuman> = 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<MiniHuman>) -> String {
return "".to_string()
}