capra_core/common/tank.rs
1use crate::common::gas::Gas;
2
3/// A diving cylinder filled with some gas mix with some volume and service pressure.
4#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
5#[cfg_attr(feature = "use-serde", derive(serde::Serialize, serde::Deserialize))]
6pub struct Tank {
7 /// Gas mix currently inside the tank.
8 gas: Gas,
9 /// Physical volume inside the tank.
10 raw_volume: usize,
11 /// Manufacturer specified service pressure of the tank.
12 service_pressure: usize,
13}
14
15impl Tank {
16 /// Return a new tank with the given parameters
17 /// # Arguments
18 /// * `gas` - Gas mix currently inside the tank.
19 /// * `raw_volume` - Physical volume inside the tank.
20 /// * `service_pressure` - Manufacturer specified service pressure of the tank.
21 pub fn new(gas: Gas, raw_volume: usize, service_pressure: usize) -> Self {
22 Tank {
23 gas,
24 raw_volume,
25 service_pressure,
26 }
27 }
28}