Skip to main content

MissingValue

Trait MissingValue 

pub trait MissingValue {
    // Required methods
    fn missing() -> Self;
    fn is_missing(&self) -> bool;
}
Expand description

Missing values defined in the GRIB2 regulation.

Regulation 92.1.4 states as follows:

All bits set to “1” for any value indicates that value is missing. This rule shall not apply to packed data.

§Examples

use grib_template_helpers::{MissingValue, TryFromSlice};

let missing = i32::missing();
let read_from_slice =
    i32::try_from_slice(&[0xff, 0xff, 0xff, 0xff].as_slice(), &mut 0).unwrap();
assert_eq!(missing, read_from_slice);
assert!(missing.is_missing());

Required Methods§

fn missing() -> Self

Returns missing value.

For NonStdLenUint, the result uses the full width of its underlying integer type. To represent a missing value of a shorter width, construct it with NonStdLenUint::new and all bits set within that width.

fn is_missing(&self) -> bool

Checks if the value is regarded as a missing value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl MissingValue for f32

§

fn missing() -> f32

§

fn is_missing(&self) -> bool

§

impl MissingValue for f64

§

fn missing() -> f64

§

fn is_missing(&self) -> bool

§

impl MissingValue for i8

§

fn missing() -> i8

§

fn is_missing(&self) -> bool

§

impl MissingValue for i16

§

fn missing() -> i16

§

fn is_missing(&self) -> bool

§

impl MissingValue for i32

§

fn missing() -> i32

§

fn is_missing(&self) -> bool

§

impl MissingValue for i64

§

fn missing() -> i64

§

fn is_missing(&self) -> bool

§

impl MissingValue for u8

§

fn missing() -> u8

§

fn is_missing(&self) -> bool

§

impl MissingValue for u16

§

fn missing() -> u16

§

fn is_missing(&self) -> bool

§

impl MissingValue for u32

§

fn missing() -> u32

§

fn is_missing(&self) -> bool

§

impl MissingValue for u64

§

fn missing() -> u64

§

fn is_missing(&self) -> bool

Implementors§

§

impl MissingValue for NonStdLenUint<u8>

§

impl MissingValue for NonStdLenUint<u16>

§

impl MissingValue for NonStdLenUint<u32>

§

impl MissingValue for NonStdLenUint<u64>