chore(cargo): convert project to lib
now the project is called libmatrix
This commit is contained in:
parent
fcf4d05b8a
commit
7743b25ecb
4 changed files with 12 additions and 27 deletions
|
|
@ -2,5 +2,7 @@
|
|||
name = "matrix-rs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "matrix"
|
||||
path = "src/lib.rs"
|
||||
[dependencies]
|
||||
|
|
|
|||
8
src/lib.rs
Normal file
8
src/lib.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
mod types;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub fn test() {
|
||||
println!("Testing code here");
|
||||
}
|
||||
25
src/main.rs
25
src/main.rs
|
|
@ -1,25 +0,0 @@
|
|||
use std::{error::Error, io::stdin, str::FromStr};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use types::{matrix::Matrix, matrix_err::ParseMatrixError};
|
||||
|
||||
mod types;
|
||||
fn handle_input() -> Result<Matrix, ParseMatrixError> {
|
||||
let input = stdin();
|
||||
let mut construct_string = String::from("");
|
||||
loop {
|
||||
let mut s = "".to_string();
|
||||
let _ = input.read_line(&mut s);
|
||||
if s == "exit\n" {
|
||||
break;
|
||||
}
|
||||
construct_string += &s;
|
||||
}
|
||||
Matrix::from_str(construct_string.trim_end())
|
||||
}
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let m = handle_input()?;
|
||||
Ok(println!("The matrix is:\n{}", m))
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use std::{error::Error, str::FromStr};
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::types::{matrix::Matrix, matrix_err::ParseMatrixError};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue