Skip to main content

harmos_domain/
presentation.rs

1/* ***
2 *
3 * Harmos
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * ***
8 */
9
10/* === Modules === */
11
12/* === Re-Exports === */
13
14/* === Imports === */
15
16// Standard Library Imports
17
18// Third Party Imports
19use serde::{Deserialize, Serialize};
20// Local Imports
21use crate::Metadata;
22
23/* === Constants === */
24
25/* === Macros === */
26
27/* === Type Aliases === */
28
29/* === Structs === */
30
31#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
32#[serde(deny_unknown_fields)]
33pub struct StreamField {
34    pub metadata: Metadata,
35
36    #[serde(default)]
37    pub role: Option<String>,
38
39    #[serde(default)]
40    pub unit: Option<String>,
41}
42
43/* === Enums === */
44
45/* === Traits === */
46
47pub trait RowMetadata {
48    const ROW_METADATA_JSON: &'static str = "[]";
49
50    fn row_metadata() -> Vec<StreamField> {
51        serde_json::from_str(Self::ROW_METADATA_JSON).expect("macro-generated row metadata is valid")
52    }
53}
54
55/* === Implementations === */
56
57/* === Public Functions === */
58
59/* === Private Functions === */
60
61/* === Tests === */