Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ww/define space and dimension #1

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
277 changes: 277 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
counter = "0.5.6"
num-traits = "0.2.15"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"

[dev-dependencies]
rstest = "0.15.0"
20 changes: 20 additions & 0 deletions src/dimension.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use serde::Serialize;

use crate::space::Space;

#[derive(Clone, Debug, PartialEq, Serialize)]
pub enum Dimension {
Integer { loc: i32 },
Real { loc: f64 },
Space(Space)
}

impl Dimension {
pub fn update(&self, dim: Dimension) -> Dimension {
match dim {
Dimension::Integer { loc: x } => Dimension::Integer { loc: x },
Dimension::Real { loc: x } => Dimension::Real { loc: x },
Dimension::Space(spc) => Dimension::Space(spc)
}
}
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod space;
pub mod dimension;
Loading