From 0b68bcfdfa1c1bca878c11bac51877b725c77c00 Mon Sep 17 00:00:00 2001 From: Kuba Groblewski Date: Thu, 31 Oct 2024 00:10:35 +0100 Subject: [PATCH 1/2] DiveState type exported, added derives --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/buehlmann/compartment.rs | 2 +- src/common/deco.rs | 4 ++-- src/common/deco_model.rs | 2 +- src/lib.rs | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86736d9..1cb03d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -168,7 +168,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "dive-deco" -version = "4.3.3" +version = "4.3.4" dependencies = [ "criterion", ] diff --git a/Cargo.toml b/Cargo.toml index e27bd0b..62e288d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dive-deco" -version = "4.3.3" +version = "4.3.4" edition = "2021" license = "MIT" description = "A dive decompression models library (Buehlmann ZH-L 16C)" diff --git a/src/buehlmann/compartment.rs b/src/buehlmann/compartment.rs index e114812..69e4df6 100644 --- a/src/buehlmann/compartment.rs +++ b/src/buehlmann/compartment.rs @@ -28,7 +28,7 @@ pub struct Compartment { model_config: BuehlmannConfig, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub struct Supersaturation { pub gf_99: f64, pub gf_surf: f64, diff --git a/src/common/deco.rs b/src/common/deco.rs index 7e0c513..b397196 100644 --- a/src/common/deco.rs +++ b/src/common/deco.rs @@ -38,7 +38,7 @@ pub struct Deco { sim: bool, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Default, Clone)] pub struct DecoRuntime { // runtime pub deco_stages: Vec, @@ -53,7 +53,7 @@ pub struct DecoRuntime { #[derive(Debug)] struct MissedDecoStopViolation; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub enum DecoCalculationError { EmptyGasList, CurrentGasNotInList, diff --git a/src/common/deco_model.rs b/src/common/deco_model.rs index adfc8cd..cdc1b2c 100644 --- a/src/common/deco_model.rs +++ b/src/common/deco_model.rs @@ -26,7 +26,7 @@ pub trait DecoModelConfig { fn round_ceiling(&self) -> bool; } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct DiveState { pub depth: Depth, pub time: Seconds, diff --git a/src/lib.rs b/src/lib.rs index a829808..1b73a38 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,6 +5,6 @@ pub use buehlmann::{BuehlmannConfig, BuehlmannModel, Supersaturation}; pub use common::{ CeilingType, Deco, DecoCalculationError, DecoModel, DecoRuntime, DecoStage, DecoStageType, - Depth, Gas, GradientFactors, Minutes, MinutesSigned, NDLType, Pressure, RecordData, Seconds, - Sim, + Depth, DiveState, Gas, GradientFactors, Minutes, MinutesSigned, NDLType, Pressure, RecordData, + Seconds, Sim, }; From cac8aa6bcaf83c14af78c3781e162f69a7710ac6 Mon Sep 17 00:00:00 2001 From: Kuba Groblewski Date: Thu, 31 Oct 2024 00:33:46 +0100 Subject: [PATCH 2/2] Compartment type pub --- src/buehlmann/mod.rs | 2 +- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/buehlmann/mod.rs b/src/buehlmann/mod.rs index f69086d..d925ee5 100644 --- a/src/buehlmann/mod.rs +++ b/src/buehlmann/mod.rs @@ -5,4 +5,4 @@ mod zhl_values; pub use buehlmann_config::BuehlmannConfig; pub use buehlmann_model::BuehlmannModel; -pub use compartment::Supersaturation; +pub use compartment::{Compartment, Supersaturation}; diff --git a/src/lib.rs b/src/lib.rs index 1b73a38..447e689 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ mod buehlmann; mod common; -pub use buehlmann::{BuehlmannConfig, BuehlmannModel, Supersaturation}; +pub use buehlmann::{BuehlmannConfig, BuehlmannModel, Compartment, Supersaturation}; pub use common::{ CeilingType, Deco, DecoCalculationError, DecoModel, DecoRuntime, DecoStage, DecoStageType,