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