MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / enrich_simulators

Method enrich_simulators

packages/server/src/simulators/registry.rs:153–179  ·  view source on GitHub ↗
(&self, simulators: Vec<Simulator>)

Source from the content-addressed store, hash-verified

151 }
152
153 pub fn enrich_simulators(&self, simulators: Vec<Simulator>) -> Vec<serde_json::Value> {
154 simulators
155 .into_iter()
156 .map(|simulator| {
157 let private_display = self
158 .store
159 .get(&simulator.udid)
160 .map(|session| session.snapshot())
161 .unwrap_or_else(|| {
162 json!({
163 "displayReady": false,
164 "displayStatus": if simulator.is_booted { "Detached" } else { "Boot required" },
165 "displayWidth": 0,
166 "displayHeight": 0,
167 "frameSequence": 0,
168 "lastFrameAt": 0,
169 "rotationQuarterTurns": 0,
170 })
171 });
172 let mut entry = serde_json::to_value(&simulator).unwrap_or_else(|_| json!({}));
173 if let Some(object) = entry.as_object_mut() {
174 object.insert("privateDisplay".to_owned(), private_display);
175 }
176 entry
177 })
178 .collect()
179 }
180}
181
182#[cfg(test)]

Callers 1

all_device_valuesFunction · 0.80

Calls 3

insertMethod · 0.80
getMethod · 0.65
snapshotMethod · 0.45

Tested by

no test coverage detected