| 1 | //! Contains all different levels of quality. |
| 2 | //! And allows to find easily max bits per version/quality pair |
| 3 | |
| 4 | #![deny(unsafe_code)] |
| 5 | #![warn(missing_docs)] |
| 6 | |
| 7 | use std::fmt::Write; |
| 8 | |
| 9 | /// Error Correction Coding has 4 levels |
| 10 | #[derive(Copy, Clone, Debug)] |
| 11 | #[allow(dead_code)] |
| 12 | #[cfg_attr(feature = "wasm-bindgen", wasm_bindgen::prelude::wasm_bindgen)] |
| 13 | pub enum ECL { |
| 14 | /// Low, 7% |
| 15 | L, |
| 16 | /// Medium, 15% |
| 17 | M, |
| 18 | /// Quartile, 25% |
| 19 | Q, |
| 20 | /// High, 30% |
| 21 | H, |
| 22 | } |
| 23 | |
| 24 | impl core::fmt::Display for ECL { |
| 25 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 26 | match self { |
| 27 | ECL::L => f.write_char('L'), |
| 28 | ECL::M => f.write_char('M'), |
| 29 | ECL::Q => f.write_char('Q'), |
| 30 | ECL::H => f.write_char('H'), |
| 31 | } |
| 32 | } |
| 33 | } |