MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / json_value

Function json_value

crates/openshell-driver-docker/src/tests.rs:127–155  ·  view source on GitHub ↗
(value: serde_json::Value)

Source from the content-addressed store, hash-verified

125}
126
127fn json_value(value: serde_json::Value) -> prost_types::Value {
128 match value {
129 serde_json::Value::Null => prost_types::Value { kind: None },
130 serde_json::Value::Bool(value) => prost_types::Value {
131 kind: Some(prost_types::value::Kind::BoolValue(value)),
132 },
133 serde_json::Value::Number(value) => prost_types::Value {
134 kind: value.as_f64().map(prost_types::value::Kind::NumberValue),
135 },
136 serde_json::Value::String(value) => prost_types::Value {
137 kind: Some(prost_types::value::Kind::StringValue(value)),
138 },
139 serde_json::Value::Array(values) => prost_types::Value {
140 kind: Some(prost_types::value::Kind::ListValue(
141 prost_types::ListValue {
142 values: values.into_iter().map(json_value).collect(),
143 },
144 )),
145 },
146 serde_json::Value::Object(values) => prost_types::Value {
147 kind: Some(prost_types::value::Kind::StructValue(prost_types::Struct {
148 fields: values
149 .into_iter()
150 .map(|(key, value)| (key, json_value(value)))
151 .collect(),
152 })),
153 },
154 }
155}
156
157fn inspected_volume(driver: &str, options: HashMap<String, String>) -> bollard::models::Volume {
158 bollard::models::Volume {

Callers 1

json_structFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected