From c1484ab49de7e11211fc2392a7ee74b3d4b32928 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Tue, 22 Aug 2023 21:20:11 -0400 Subject: [PATCH] Started to move things over Moved over some objects and function declarations. Migrating the implementation will be the fun part --- src/main.rs | 30 +++++++++++++++++++++++++++++- src/parser.rs | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/parser.rs diff --git a/src/main.rs b/src/main.rs index e7a11a9..41289c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,31 @@ +use std::env; + +mod parser; + fn main() { - println!("Hello, world!"); + let args: Vec = env::args().collect(); + + if args.len() < 2 { + println!("Provide path to file"); + return; + } + + let filepath: &String = args.get(1).unwrap(); + + println!("Filepath is: {:?}", filepath); + + let myparser = parser::parser::NumberParser + { + filepath: filepath.clone() + }; + + myparser.prompt(); + + let rawvalues = myparser.filedump(); + + let parsed_values = myparser.updatevalues(rawvalues); + myparser.removedups(&parsed_values); + + myparser.print_values(&parsed_values); + myparser.save_file(parsed_values); } diff --git a/src/parser.rs b/src/parser.rs new file mode 100644 index 0000000..ed4eed6 --- /dev/null +++ b/src/parser.rs @@ -0,0 +1,39 @@ +pub mod parser { + pub struct SomeObject { + pub value: String + } + + pub struct NumberParser { + pub filepath: String + } + + impl NumberParser { + pub fn prompt(&self) { + println!("Hello!") + } + + pub fn filedump(&self) -> Vec { + let objs: Vec = Vec::new(); + + return objs; + } + + pub fn updatevalues(&self, vals: Vec) -> Vec { + let updated: Vec = Vec::new(); + return updated; + } + + pub fn removedups(&self, vals: &Vec) { + println!("Hi"); + } + pub fn print_values(&self, vals: &Vec) { + for o in vals { + println!("Value: {}", o.value); + } + } + + pub fn save_file(&self, vals: Vec) { + println!("Hi"); + } + } +}