MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / query

Method query

packages/server/src/inspector.rs:674–698  ·  view source on GitHub ↗
(&self, method: &str, params: Value, wait: Duration)

Source from the content-addressed store, hash-verified

672
673impl InspectorAgentHandle {
674 async fn query(&self, method: &str, params: Value, wait: Duration) -> Result<Value, String> {
675 let id = self.next_request_id.fetch_add(1, Ordering::Relaxed);
676 let request = json!({
677 "id": id,
678 "method": method,
679 "params": params,
680 });
681 let (response_tx, response_rx) = oneshot::channel();
682 self.pending.lock().await.insert(id, response_tx);
683
684 self.outbox.lock().await.push_back(request.clone());
685 self.outbox_notify.notify_waiters();
686 let _ = self.outgoing.send(request).await;
687
688 match timeout(wait, response_rx).await {
689 Ok(Ok(result)) => result,
690 Ok(Err(_)) => Err("NativeScript inspector response channel closed.".to_owned()),
691 Err(_) => {
692 self.pending.lock().await.remove(&id);
693 Err(format!(
694 "Timed out waiting for NativeScript inspector method {method}."
695 ))
696 }
697 }
698 }
699
700 async fn poll(&self, wait: Duration) -> Result<Option<Value>, String> {
701 let deadline = Instant::now() + wait;

Callers 7

handle_socketMethod · 0.80
query_with_timeoutMethod · 0.80
require_api_authFunction · 0.80
metro_proxy_rootFunction · 0.80
metro_proxy_assetFunction · 0.80
expectElementContainsFunction · 0.80
safeQueryFunction · 0.80

Calls 4

insertMethod · 0.80
cloneMethod · 0.65
sendMethod · 0.65
removeMethod · 0.65

Tested by

no test coverage detected