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

Function inspector_response

packages/server/src/api/routes.rs:1717–1735  ·  view source on GitHub ↗
(
    State(state): State<AppState>,
    Json(payload): Json<InspectorResponsePayload>,
)

Source from the content-addressed store, hash-verified

1715}
1716
1717async fn inspector_response(
1718 State(state): State<AppState>,
1719 Json(payload): Json<InspectorResponsePayload>,
1720) -> Result<StatusCode, AppError> {
1721 let mut response = Map::new();
1722 response.insert("id".to_owned(), Value::Number(payload.id.into()));
1723 if let Some(error) = payload.error {
1724 response.insert("error".to_owned(), error);
1725 } else {
1726 response.insert("result".to_owned(), payload.result.unwrap_or(Value::Null));
1727 }
1728
1729 state
1730 .inspectors
1731 .complete_response(payload.process_identifier, Value::Object(response))
1732 .await
1733 .map_err(AppError::native)?;
1734 Ok(StatusCode::NO_CONTENT)
1735}
1736
1737async fn list_simulators(State(state): State<AppState>) -> Result<Json<Value>, AppError> {
1738 let simulators = all_device_values(state.clone(), false).await?;

Callers

nothing calls this directly

Calls 2

insertMethod · 0.80
complete_responseMethod · 0.80

Tested by

no test coverage detected