cimstructs/
WindContQPQULimIEC.rs1#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
3pub struct WindContQPQULimIEC {
4 #[serde(flatten)]
5 pub base: super::IdentifiedObject,
6 #[serde(skip_serializing_if = "Option::is_none")]
8 pub tpfiltql: Option<f64>,
9 #[serde(skip_serializing_if = "Option::is_none")]
11 pub tufiltql: Option<f64>,
12}
13impl crate::base::CimElement for WindContQPQULimIEC {
14 fn mrid(&self) -> &str { &self.base.id }
15 fn type_name(&self) -> &'static str { "WindContQPQULimIEC" }
16 fn as_any(&self) -> &dyn std::any::Any { self }
17 fn to_json_value(&self) -> serde_json::Value {
18 serde_json::to_value(self).unwrap_or(serde_json::Value::Null)
19 }
20 fn to_block(&self) -> crate::base::RdfBlock {
21 let mut block = self.base.to_block();
22 block.type_name = "WindContQPQULimIEC".to_string();
23 if let Some(v) = self.tpfiltql {
24 block.fields.insert("WindContQPQULimIEC.tpfiltql".into(), crate::base::FieldValue::Text(v.to_string()));
25 }
26 if let Some(v) = self.tufiltql {
27 block.fields.insert("WindContQPQULimIEC.tufiltql".into(), crate::base::FieldValue::Text(v.to_string()));
28 }
29 block
30 }
31}
32
33impl WindContQPQULimIEC {
34 pub fn from_block(b: &crate::base::RdfBlock) -> Self {
35 let mut obj = Self::default();
36 obj.base.id.clone_from(&b.mrid);
37 for (key, val) in &b.fields {
38 match key.as_str() {
39 "WindContQPQULimIEC.tpfiltql" => {
40 match val {
41 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tpfiltql = Some(v); } }
42 crate::base::FieldValue::TextList(svs) => {
43 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tpfiltql = Some(v); } }
44 }
45 _ => {}
46 }
47 }
48 "WindContQPQULimIEC.tufiltql" => {
49 match val {
50 crate::base::FieldValue::Text(sv) => { if let Ok(v) = sv.trim().parse() { obj.tufiltql = Some(v); } }
51 crate::base::FieldValue::TextList(svs) => {
52 if let Some(sv) = svs.last() { if let Ok(v) = sv.trim().parse() { obj.tufiltql = Some(v); } }
53 }
54 _ => {}
55 }
56 }
57 "IdentifiedObject.description" => {
58 match val {
59 crate::base::FieldValue::Text(sv) => { obj.base.description = sv.clone(); }
60 crate::base::FieldValue::TextList(svs) => {
61 if let Some(sv) = svs.last() { obj.base.description = sv.clone(); }
62 }
63 _ => {}
64 }
65 }
66 "IdentifiedObject.energyIdentCodeEic" => {
67 match val {
68 crate::base::FieldValue::Text(sv) => { obj.base.energy_ident_code_eic = sv.clone(); }
69 crate::base::FieldValue::TextList(svs) => {
70 if let Some(sv) = svs.last() { obj.base.energy_ident_code_eic = sv.clone(); }
71 }
72 _ => {}
73 }
74 }
75 "IdentifiedObject.mRID" => {
76 match val {
77 crate::base::FieldValue::Text(sv) => { obj.base.m_rid = sv.clone(); }
78 crate::base::FieldValue::TextList(svs) => {
79 if let Some(sv) = svs.last() { obj.base.m_rid = sv.clone(); }
80 }
81 _ => {}
82 }
83 }
84 "IdentifiedObject.name" => {
85 match val {
86 crate::base::FieldValue::Text(sv) => { obj.base.name = sv.clone(); }
87 crate::base::FieldValue::TextList(svs) => {
88 if let Some(sv) = svs.last() { obj.base.name = sv.clone(); }
89 }
90 _ => {}
91 }
92 }
93 "IdentifiedObject.shortName" => {
94 match val {
95 crate::base::FieldValue::Text(sv) => { obj.base.short_name = sv.clone(); }
96 crate::base::FieldValue::TextList(svs) => {
97 if let Some(sv) = svs.last() { obj.base.short_name = sv.clone(); }
98 }
99 _ => {}
100 }
101 }
102 _ => {}
103 }
104 }
105 obj
106 }
107}