gistools/readers/grib2/sections/_6/
tables.rs1#![cfg_attr(feature = "nightly", coverage(off))]
2
3#[repr(u8)]
23#[allow(missing_docs)]
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25pub enum Grib2Table6_0 {
26 BitmapSpecifiedInThisSection = 0,
27 BitmapPredeterminedByCenter(u8), BitmapPreviouslyDefined = 254,
29 BitmapDoesNotApply = 255,
30}
31impl From<u8> for Grib2Table6_0 {
32 fn from(val: u8) -> Self {
33 match val {
34 0 => Self::BitmapSpecifiedInThisSection,
35 1..=253 => Self::BitmapPredeterminedByCenter(val),
36 254 => Self::BitmapPreviouslyDefined,
37 255 => Self::BitmapDoesNotApply,
38 }
39 }
40}
41impl core::fmt::Display for Grib2Table6_0 {
42 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
43 let desc = match self {
44 Self::BitmapSpecifiedInThisSection => {
45 "A bit map applies to this product and is specified in this section."
46 }
47 Self::BitmapPredeterminedByCenter(v) => {
48 return write!(
49 f,
50 "A bit map pre-determined by the originating/generating center applies to \
51 this product and is not specified in this section. (Value: {v})"
52 );
53 }
54 Self::BitmapPreviouslyDefined => {
55 "A bit map previously defined in the same GRIB2 message applies to this product."
56 }
57 Self::BitmapDoesNotApply => "A bit map does not apply to this product.",
58 };
59 f.write_str(desc)
60 }
61}