Restructured the project to use cargo workspace, math module is now a separate crate

This commit is contained in:
Egor 2024-05-23 11:08:52 +03:00
parent a998ec4339
commit 211fc67cf2
11 changed files with 17 additions and 20 deletions

2
Cargo.lock generated
View file

@ -9,7 +9,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]] [[package]]
name = "mathematical" name = "math"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"num", "num",

View file

@ -1,7 +1,5 @@
[package] [workspace]
name = "mathematical" resolver = "2"
version = "0.1.0" members = [
edition = "2021" "math"
]
[dependencies]
num = "0.4.3"

7
math/Cargo.toml Normal file
View file

@ -0,0 +1,7 @@
[package]
name = "math"
version = "0.1.0"
edition = "2021"
[dependencies]
num = "0.4.3"

2
math/src/lib.rs Normal file
View file

@ -0,0 +1,2 @@
pub mod matrix;
pub mod sq_matrix;

View file

@ -108,7 +108,7 @@ impl<T: Num> IndexMut<(usize, usize)> for Matrix<T> {
#[macro_export] #[macro_export]
macro_rules! matrix { macro_rules! matrix {
[ $w:expr; $( $x:expr ),+ ] => { [ $w:expr; $( $x:expr ),+ ] => {
$crate::math::Matrix::new(vec![$( $x, )+], $w) $crate::matrix::Matrix::new(vec![$( $x, )+], $w)
}; };
} }

View file

@ -45,8 +45,6 @@ fn check_size(order: usize) -> usize {
#[macro_export] #[macro_export]
macro_rules! sq_matrix { macro_rules! sq_matrix {
[ $o:expr; $( $x:expr ),+ ] => { [ $o:expr; $( $x:expr ),+ ] => {
$crate::math::SquareMatrix::new(vec![$( $x, )+], $o) $crate::matrix::SquareMatrix::new(vec![$( $x, )+], $o)
}; };
} }
pub use sq_matrix;

View file

@ -1 +0,0 @@
pub mod math;

View file

@ -1,7 +0,0 @@
mod matrix;
pub use matrix::Matrix;
pub use matrix::matrix;
mod sq_matrix;
pub use sq_matrix::SquareMatrix;
pub use sq_matrix::sq_matrix;