cognite/dto/data_modeling/instances/extensions/
units.rs

1use serde::{Deserialize, Serialize};
2use serde_with::skip_serializing_none;
3
4use super::{common::CogniteDescribable, CogniteExtendable, WithView};
5
6/// Represents a single unit of measurement.
7pub type CogniteUnit = CogniteExtendable<Unit>;
8
9#[skip_serializing_none]
10#[derive(Serialize, Deserialize, Clone, Debug, Default)]
11#[serde(rename_all = "camelCase")]
12/// The properties of the file object.
13pub struct Unit {
14    #[serde(flatten)]
15    /// Cognite describable.
16    pub description: CogniteDescribable,
17    /// The symbol for the unit of measurement.
18    pub symbol: Option<String>,
19    /// Specifies the physical quantity the unit measures.
20    pub quantity: Option<String>,
21    /// Source of the unit definition
22    pub source: Option<String>,
23    /// Reference to the source of the unit definition.
24    pub source_reference: Option<String>,
25}
26
27impl WithView for Unit {
28    const SPACE: &'static str = "cdf_cdm";
29    const EXTERNAL_ID: &'static str = "CogniteUnit";
30    const VERSION: &'static str = "v1";
31}