openstack_types/block_storage/v3/consistencygroup/response/
set.rs1use serde::{Deserialize, Serialize};
20use serde_json::Value;
21use std::collections::BTreeMap;
22use structable::{StructTable, StructTableOptions};
23
24#[derive(Deserialize, Serialize)]
26pub struct ConsistencygroupResponse(BTreeMap<String, Value>);
27
28impl StructTable for ConsistencygroupResponse {
29 fn instance_headers<O: StructTableOptions>(&self, _options: &O) -> Option<Vec<String>> {
30 Some(self.0.keys().map(Into::into).collect())
31 }
32
33 fn data<O: StructTableOptions>(&self, _options: &O) -> Vec<Option<String>> {
34 Vec::from_iter(self.0.values().map(|v| serde_json::to_string(&v).ok()))
35 }
36}
37
38impl StructTable for &ConsistencygroupResponse {
39 fn instance_headers<O: StructTableOptions>(&self, _options: &O) -> Option<Vec<String>> {
40 Some(self.0.keys().map(Into::into).collect())
41 }
42
43 fn data<O: StructTableOptions>(&self, _options: &O) -> Vec<Option<String>> {
44 Vec::from_iter(self.0.values().map(|v| serde_json::to_string(&v).ok()))
45 }
46}