(&self, py: Python, n: usize, dur: u64)
| 45 | } |
| 46 | |
| 47 | fn batch_recv(&self, py: Python, n: usize, dur: u64) -> (Vec<PyObject>, bool) { |
| 48 | let convert = |envelope| { |
| 49 | Py::new( |
| 50 | py, |
| 51 | PyEnvelope { |
| 52 | imp: Some(envelope), |
| 53 | }, |
| 54 | ) |
| 55 | .unwrap() |
| 56 | .to_object(py) |
| 57 | }; |
| 58 | match with_context(py, || { |
| 59 | wait( |
| 60 | self.imp |
| 61 | .batch_recv::<PyObject>(n, Duration::from_millis(dur)), |
| 62 | ) |
| 63 | }) { |
| 64 | Ok(msg) => (msg.into_iter().map(convert).collect(), false), |
| 65 | Err(BatchRecvError::Closed(msg)) => (msg.into_iter().map(convert).collect(), true), |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | pub trait Owned2PyObject { |
nothing calls this directly
no test coverage detected