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

Function complete_pending_response_value

packages/server/src/inspector.rs:777–798  ·  view source on GitHub ↗
(pending: &PendingResponses, value: Value)

Source from the content-addressed store, hash-verified

775}
776
777async fn complete_pending_response_value(pending: &PendingResponses, value: Value) {
778 let Some(id) = value.get("id").and_then(Value::as_u64) else {
779 return;
780 };
781 let Some(response_tx) = pending.lock().await.remove(&id) else {
782 return;
783 };
784
785 let result = if let Some(error) = value.get("error") {
786 Err(error
787 .get("message")
788 .and_then(Value::as_str)
789 .map(str::to_owned)
790 .unwrap_or_else(|| error.to_string()))
791 } else {
792 value
793 .get("result")
794 .cloned()
795 .ok_or_else(|| "Inspector response did not include result.".to_owned())
796 };
797 let _ = response_tx.send(result);
798}
799
800fn inspector_info_from_response(response: &Value) -> Option<Value> {
801 let result = response.get("result")?;

Callers 2

complete_responseMethod · 0.85
handle_incoming_messageFunction · 0.85

Calls 3

getMethod · 0.65
removeMethod · 0.65
sendMethod · 0.65

Tested by

no test coverage detected