Started to move things over
Moved over some objects and function declarations. Migrating the implementation will be the fun part
This commit is contained in:
+29
-1
@@ -1,3 +1,31 @@
|
|||||||
|
use std::env;
|
||||||
|
|
||||||
|
mod parser;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world!");
|
let args: Vec<String> = 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<SomeObject> {
|
||||||
|
let objs: Vec<SomeObject> = Vec::new();
|
||||||
|
|
||||||
|
return objs;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn updatevalues(&self, vals: Vec<SomeObject>) -> Vec<SomeObject> {
|
||||||
|
let updated: Vec<SomeObject> = Vec::new();
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn removedups(&self, vals: &Vec<SomeObject>) {
|
||||||
|
println!("Hi");
|
||||||
|
}
|
||||||
|
pub fn print_values(&self, vals: &Vec<SomeObject>) {
|
||||||
|
for o in vals {
|
||||||
|
println!("Value: {}", o.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn save_file(&self, vals: Vec<SomeObject>) {
|
||||||
|
println!("Hi");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user