integer_or_float 0.3.2

A data type holding an ‘integer or float’ (a data type in the Unified Font Object specification, among others)
Documentation
use core::hash::{Hash, Hasher};

use super::IntegerOrFloat::{self, *};

impl Hash for IntegerOrFloat {
    fn hash<H: Hasher>(&self, state: &mut H) {
        match self {
            Integer(i) => i.hash(state),
            Float(f) => {
                if f.is_nan() {
                    panic!("Cannot hash a NaN")
                }
                let u64_f = f.to_bits();
                u64_f.hash(state)
            }
        }
    }
}

impl Eq for IntegerOrFloat {}