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

Function booted_first

packages/server/src/api/routes.rs:5483–5499  ·  view source on GitHub ↗
(values: Vec<Value>)

Source from the content-addressed store, hash-verified

5481}
5482
5483fn booted_first(values: Vec<Value>) -> Vec<Value> {
5484 let mut indexed_values = values.into_iter().enumerate().collect::<Vec<_>>();
5485 indexed_values.sort_by(|(left_index, left), (right_index, right)| {
5486 let left_booted = left
5487 .get("isBooted")
5488 .and_then(Value::as_bool)
5489 .unwrap_or(false);
5490 let right_booted = right
5491 .get("isBooted")
5492 .and_then(Value::as_bool)
5493 .unwrap_or(false);
5494 right_booted
5495 .cmp(&left_booted)
5496 .then_with(|| left_index.cmp(right_index))
5497 });
5498 indexed_values.into_iter().map(|(_, value)| value).collect()
5499}
5500
5501async fn list_simulators_cached(
5502 state: AppState,

Callers 1

all_device_valuesFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected