rsiot/message/phy_quantity/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//! Представление физической величины

mod ops;
mod quantities;
mod quantity_name;

use quantity_name::QuantityName;
use serde::{Deserialize, Serialize};

/// Физическая величина
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct PhyQuantity {
    pub(crate) value: f64,
    /// Тип физической величины
    pub quantity_name: QuantityName,
}

impl PhyQuantity {
    /// Задать безразмероное значение
    pub fn new(value: f64) -> Self {
        Self {
            value,
            quantity_name: QuantityName::Dimensionless,
        }
    }
}