tmflib 0.1.38

Interface library for processing TMF payloads
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use serde::{Deserialize, Serialize};
///An amount in a given unit
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Quantity {
    ///Numeric value in a given unit
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub amount: Option<f64>,
    ///Unit
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub units: Option<String>,
}
impl std::fmt::Display for Quantity {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
        write!(f, "{}", serde_json::to_string(self).unwrap())
    }
}