| 1135 | } |
| 1136 | |
| 1137 | fn json_value(value: Value) -> prost_types::Value { |
| 1138 | match value { |
| 1139 | Value::Null => prost_types::Value { kind: None }, |
| 1140 | Value::Bool(value) => prost_types::Value { |
| 1141 | kind: Some(prost_types::value::Kind::BoolValue(value)), |
| 1142 | }, |
| 1143 | Value::Number(value) => prost_types::Value { |
| 1144 | kind: value.as_f64().map(prost_types::value::Kind::NumberValue), |
| 1145 | }, |
| 1146 | Value::String(value) => prost_types::Value { |
| 1147 | kind: Some(prost_types::value::Kind::StringValue(value)), |
| 1148 | }, |
| 1149 | Value::Array(values) => prost_types::Value { |
| 1150 | kind: Some(prost_types::value::Kind::ListValue( |
| 1151 | prost_types::ListValue { |
| 1152 | values: values.into_iter().map(json_value).collect(), |
| 1153 | }, |
| 1154 | )), |
| 1155 | }, |
| 1156 | Value::Object(values) => prost_types::Value { |
| 1157 | kind: Some(prost_types::value::Kind::StructValue(prost_types::Struct { |
| 1158 | fields: values |
| 1159 | .into_iter() |
| 1160 | .map(|(key, value)| (key, json_value(value))) |
| 1161 | .collect(), |
| 1162 | })), |
| 1163 | }, |
| 1164 | } |
| 1165 | } |
| 1166 | |
| 1167 | fn gpu_resources(count: Option<u32>) -> ResourceRequirements { |
| 1168 | ResourceRequirements { |