generated from OBJNULL/Dockerized-Rust
Compare commits
4 commits
7f6a9c41c9
...
e62131ba1f
Author | SHA1 | Date | |
---|---|---|---|
e62131ba1f | |||
d7075bce86 | |||
891a608f6f | |||
d68f59aedd |
7 changed files with 72 additions and 1 deletions
21
project/src/config.rs
Normal file
21
project/src/config.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Libraries
|
||||
use std::env;
|
||||
|
||||
// Enums
|
||||
pub enum OperationMode {
|
||||
Training,
|
||||
Infrence,
|
||||
}
|
||||
|
||||
// Functions
|
||||
pub fn get_operation_mode() -> Option<OperationMode> {
|
||||
// Getting command line arguments
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
||||
// Getting operation mode
|
||||
match &args[1] {
|
||||
"training" => Some(OperationMode::Training),
|
||||
"infrence" => Some(OperationMode::Infrence),
|
||||
_ => None,
|
||||
}
|
||||
}
|
|
@ -1,6 +1,26 @@
|
|||
// Libraries
|
||||
mod config;
|
||||
mod neural;
|
||||
use neural::NeuralNetwork;
|
||||
|
||||
use std::error::Error;
|
||||
|
||||
// Entry-Point
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
// Getting Running Mode First
|
||||
let operation_mode = config::get_operation_mode();
|
||||
|
||||
// Creating a Neural Network
|
||||
let neural: NeuralNetwork;
|
||||
|
||||
// Creating a Neural Network with the Operation Mode
|
||||
match operation_mode {
|
||||
None => panic!("Main: `OperationMode` not defined!"),
|
||||
Some(mode) => {
|
||||
neural = NeuralNetwork::new(mode);
|
||||
}
|
||||
}
|
||||
|
||||
// Starting the network
|
||||
neural.start();
|
||||
}
|
||||
|
|
30
project/src/neural.rs
Normal file
30
project/src/neural.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Libraries
|
||||
mod data;
|
||||
mod infrence;
|
||||
mod model;
|
||||
mod training;
|
||||
|
||||
use super::config::OperationMode;
|
||||
|
||||
// Structures
|
||||
pub struct NeuralNetwork {
|
||||
mode: OperationMode,
|
||||
}
|
||||
|
||||
// Implementaions
|
||||
impl NeuralNetwork {
|
||||
// Constructors
|
||||
pub fn new(mode: OperationMode) -> Self {
|
||||
// Return Result
|
||||
Self { mode }
|
||||
}
|
||||
|
||||
// Functions
|
||||
pub fn start(&self) {
|
||||
// Switching based on mode
|
||||
match self.mode {
|
||||
OperationMode::Training => {}
|
||||
OperationMode::Infrence => {}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue