spark_connect/
observation.rs1use std::collections::HashMap;
6
7pub struct Observation {
11 name: String,
12 metrics: HashMap<String, String>,
13}
14
15impl Observation {
16 pub fn new(name: &str) -> Self {
18 Observation {
19 name: name.to_string(),
20 metrics: HashMap::new(),
21 }
22 }
23
24 pub fn name(&self) -> &str {
26 &self.name
27 }
28
29 pub fn get(&self) -> HashMap<String, String> {
31 self.metrics.clone()
32 }
33}
34
35#[cfg(test)]
36mod tests {
37 use super::*;
38
39 #[test]
40 fn test_observation_creation() {
41 let obs = Observation::new("test_obs");
42 assert_eq!(obs.name(), "test_obs");
43 assert!(obs.get().is_empty());
44 }
45}