haystack_types/
h_null.rs

1use num::Float;
2use crate::{HType, HVal, NumTrait};
3use crate::common::Txt;
4use std::fmt::{self,Write,Display};
5use std::str::FromStr;
6
7#[derive(PartialEq,Debug)]
8pub struct HNull;
9
10pub const NULL: HNull = HNull {};
11
12const ZINC: Txt = Txt::Const("N");
13const JSON: Txt = Txt::Const("null");
14
15const THIS_TYPE: HType = HType::Null;
16
17impl <'a,T: NumTrait + 'a>HVal<'a,T> for HNull {
18    fn to_zinc(&self, buf: &mut String) -> fmt::Result {
19        write!(buf,"{}",ZINC)
20    }
21    fn to_json(&self, buf: &mut String) -> fmt::Result {
22        write!(buf,"{}",JSON)
23    }
24    fn haystack_type(&self) -> HType { THIS_TYPE }
25
26    set_trait_eq_method!(get_null_val,'a,T);
27    set_get_method!(get_null_val, HNull);
28}