(&self, py: Python<'_>)
| 908 | #[pymethods] |
| 909 | impl BlockingRecv { |
| 910 | fn __call__(&self, py: Python<'_>) -> PyResult<PyAgentEvent> { |
| 911 | let rx = self.rx.clone(); |
| 912 | let done_flag = self.done.clone(); |
| 913 | let result = py.allow_threads(|| { |
| 914 | get_runtime().block_on(async { |
| 915 | let mut guard = rx.lock().await; |
| 916 | guard.recv().await |
| 917 | }) |
| 918 | }); |
| 919 | match result { |
| 920 | Some(event) => { |
| 921 | let is_end = matches!(event, RustAgentEvent::End { .. }); |
| 922 | let is_error = matches!(event, RustAgentEvent::Error { .. }); |
| 923 | let py_event = PyAgentEvent::from(event); |
| 924 | if is_end || is_error { |
| 925 | done_flag.store(true, Ordering::Relaxed); |
| 926 | } |
| 927 | Ok(py_event) |
| 928 | } |
| 929 | None => { |
| 930 | done_flag.store(true, Ordering::Relaxed); |
| 931 | Err(PyStopAsyncIteration::new_err("stream exhausted")) |
| 932 | } |
| 933 | } |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | /// Iterator / async-iterator that yields AgentEvents from a streaming execution. |
nothing calls this directly
no test coverage detected