diving_decompression/airtables/
mod.rs

1extern crate serde;
2extern crate serde_json;
3
4/// A specific item in one of the rows of the US Navy air no-decompression table
5#[derive(Serialize, Deserialize, Clone, Debug)]
6pub struct Group {
7  /// the repetitive group letter
8  pub group_letter: String,
9  /// the lower end of the timeframe for a specific row expressed in minutes
10  pub min_time: u16,
11  /// the higher end of the timeframe for a specific row expressed in minutes
12  pub max_time: u16,
13}
14
15/// row in the air No Decompression table
16#[derive(Serialize, Deserialize, Clone, Debug)]
17pub struct RowNdl {
18  /// the lower end of allowed depths for a specific
19  /// row expressed in Feet of sea water
20  pub min_fsw: u16,
21  /// the higher end of allowed depths for a specific 
22  /// row expressed in Feet of sea water
23  pub max_fsw: u16,
24  /// the row has unlimited no-decompression limit?
25  /// (usually no deeper than 30 Feet of sea water)
26  pub unlimited: bool,
27  /// the no decompression limit expressed in minutes
28  pub no_stop_limit: u16,
29  /// a specific item in one of the rows of the US Navy air no-decompression table
30  pub values: Vec::<Group>,
31}
32
33/// This is the main type for the entire US NAVY air No decompression table 
34#[derive(Serialize, Deserialize, Clone, Debug)]
35pub struct TableNdl {
36  /// unique id for a table within the diving-decompression project.
37  pub table_code: String,
38  /// oficially recognized name for a table.
39  pub table_name: String,
40  /// table data
41  pub table_data: Vec::<RowNdl>,
42}
43
44/// a row of the table for surface interval time and repetitive letter
45#[derive(Serialize, Deserialize, Clone, Debug)]
46pub struct RowRgl {
47  /// group letter before the surface interval time
48  pub group_letter: String,
49  /// the lower end of allowed times for a specific row expressed in minutes
50  pub min_time: u16,
51  /// the higher end of allowed times for a specific row expressed in minutes  
52  pub max_time: u16,
53  /// group letter after the surface interval time
54  pub repet_letter: String,
55}
56
57/// the table for surface interval time and repetitive letter
58#[derive(Serialize, Deserialize, Clone, Debug)]
59pub struct TableRgl {
60  /// represents a unique id for a table within the 
61  /// diving-decompression project.
62  pub table_code: String,
63  /// oficially recognized name for a table beyond the
64  /// diving-decompression project.
65  pub table_name: String,
66  /// a row of the table for surface interval time and repetitive letter
67  pub table_data: Vec::<RowRgl>,
68}
69
70/// item in the row of the table for residual nitrogen time
71#[derive(Serialize, Deserialize, Clone, Debug)]
72pub struct Rnt {
73  /// the lower end of allowed depth for a specific RNT item
74  /// expressed feet of sea water
75  pub min_depth: u16,
76  /// the higher end of allowed depth for a specific RNT item
77  /// expressed feet of sea water
78  pub max_depth: u16,
79  /// the residual nitrogen time expressed in minutes
80  pub rnt: u16,
81}
82
83/// a row in the table for residual nitrogen time
84#[derive(Serialize, Deserialize, Clone, Debug)]
85pub struct RowRnt {
86  /// the repet group letter for the residual nitrogen time item
87  pub repet_letter: String,
88  /// item in the row of the table for residual nitrogen time
89  pub rnt: Vec::<Rnt>,
90}
91
92/// the table for residual nitrogen time
93#[derive(Serialize, Deserialize, Clone, Debug)]
94pub struct TableRnt {
95  /// represents a unique id for a table within the 
96  /// diving-decompression project.
97  pub table_code: String,
98  /// oficially recognized name for a table beyond the
99  /// diving-decompression project.
100  pub table_name: String,
101  /// a note displayed when the rnt exceeds the no 
102  /// decompression limit and the profile has an unlimited
103  /// no decompression limit in the no decompression table
104  /// for shallower depths as per the US Navy dive manual
105  pub table_note_9981: String,
106  /// a row in the table for residual nitrogen time
107  pub table_data: Vec::<RowRnt>,
108}
109
110/// an item from a row of the table for air decompression
111#[derive(Serialize, Deserialize, Clone, Debug)]
112pub struct DecoStops {
113  /// the nominal depth of a specific decompression stop
114  /// expressed in feet of sea water
115  pub depth: u16,
116  /// the nominal time of a specific decompression stop
117  /// expressed in minutes
118  pub time: u16,
119}
120
121/// a row in a depth of the air decompression
122#[derive(Serialize, Deserialize, Clone, Debug)]
123pub struct RowDeco {
124  /// the lower end of allowed times for a specific row expressed in minutes
125  pub min_time: u16,
126  /// the higher end of allowed times for a specific row expressed in minutes
127  pub max_time: u16,
128  /// total ascent time when using the Air based decompression protocol
129  /// expressed in minutes
130  pub air_tat: String,
131  /// total ascent time when using in water decompression with Oxygen
132  /// expressed in minutes
133  pub o2_tat: String,
134  /// the time from leave bottom to the first scheduled decompression stop
135  pub ttfs: String,
136  /// number of chamber periods when using the SurdO2 (surface decompression
137  /// with oxygen)
138  pub o2cp: f32,
139  /// repetitive dive group letter after the decompression protocol
140  pub repetgroup_letter: String,
141  /// SurdO2 is recommended due to the extent of the decompression profile
142  pub surdo2_recommended: bool,
143  /// exceptional exposure dives are considered an anti-pattern and should
144  /// only occur in extreme situations. planning a dive with exceptional
145  /// exposure is an anti-pattern and a tremendous risk for divers health
146  pub exceptional_exposure: bool,
147  /// surdO2 is required due to the extent of the decompression profile
148  pub surdo2_required: bool,
149  /// the dive must use the SurdO2 protocol. planning these dives with for
150  /// in water decompression is an anti-pattern and must be avoided
151  pub strict_surdo2: bool,
152  /// an air decompression stop
153  pub air_deco_stops: Vec::<DecoStops>,
154  /// an o2 decompression stop
155  pub o2_deco_stops: Vec::<DecoStops>,
156}
157
158/// a depth in the air decompression table
159#[derive(Serialize, Deserialize, Clone, Debug)]
160pub struct DecoDepth {
161  /// the lower end of allowed depth for a specific profile in the 
162  /// air decompression tables expressed feet of sea water
163  pub min_fsw: u16,
164  /// the higher end of allowed depth for a specific profile in the 
165  /// air decompression tables expressed feet of sea water
166  pub max_fsw: u16,
167  /// a row in a depth of the air decompression
168  pub rows: Vec::<RowDeco>,
169}
170
171/// the air decompression table
172#[derive(Serialize, Deserialize, Clone, Debug)]
173pub struct TableAirDeco {
174  /// represents a unique id for a table within the 
175  /// diving-decompression project.
176  pub table_code: String,
177  /// oficially recognized name for a table beyond the
178  /// diving-decompression project.
179  pub table_name: String,
180  /// table data  
181  pub table_data: Vec::<DecoDepth>,
182}
183
184/// nodeco_table() returns a typed and serialized US Navy air 
185/// no-decompression table from rev7 of the US Navy dive manual.
186pub fn nodeco_table() -> serde_json::Result<TableNdl> {
187  let file = include_str!("JSON/usnavy-air-nodeco-rev7.json");
188  let sertab = serde_json::from_str(&file); 
189  return sertab;
190}
191
192/// deco_table() returns a typed and serialized US Navy air 
193/// decompression table from rev7 of the US Navy dive manual
194pub fn deco_table() -> serde_json::Result<TableAirDeco> {
195  let file = include_str!("JSON/usnavy-air-deco-rev7.json");
196  let sertab = serde_json::from_str(&file); 
197  return sertab;
198}
199
200/// rgl_table() returns a typed and serialized US Navy repetitive group letter
201/// table from rev7 of the US Navy dive manual
202pub fn rgl_table() -> serde_json::Result<TableRgl> {
203  let file = include_str!("JSON/usnavy-air-repetgroup-rev7.json");
204  let sertab = serde_json::from_str(&file); 
205  return sertab;
206}
207
208/// rnt_table() returns a typed and serialized US Navy residual nitrogen time
209/// table from rev7 of the US Navy dive manual
210pub fn rnt_table() -> serde_json::Result<TableRnt> {
211  let file = include_str!("JSON/usnavy-air-rnt-rev7.json");
212  let sertab = serde_json::from_str(&file); 
213  return sertab;
214}